iOSInjectionProject/
LingQi/Pods
ShenYin/Pods
+document/JOYGEM_AI_IOS_V1.0.18
+document/JOYGEM_AI_Android_Demo_1.0.23
+document/JOYGEM_AI_Android_Demo_1.0.23.zip
+document/JOYGEM_AI_IOS_V1.0.18.zip
--- /dev/null
+#if 0
+#elif defined(__arm64__) && __arm64__
+// Generated by Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+#ifndef JOYGEMAI_SWIFT_H
+#define JOYGEMAI_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include(<swift/objc-prologue.h>)
+# include <swift/objc-prologue.h>
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#if defined(__OBJC__)
+#include <Foundation/Foundation.h>
+#endif
+#if defined(__cplusplus)
+#include <cstdint>
+#include <cstddef>
+#include <cstdbool>
+#include <cstring>
+#include <stdlib.h>
+#include <new>
+#include <type_traits>
+#else
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+#endif
+#if defined(__cplusplus)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
+#if defined(__arm64e__) && __has_include(<ptrauth.h>)
+# include <ptrauth.h>
+#else
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
+# ifndef __ptrauth_swift_value_witness_function_pointer
+# define __ptrauth_swift_value_witness_function_pointer(x)
+# endif
+# ifndef __ptrauth_swift_class_method_pointer
+# define __ptrauth_swift_class_method_pointer(x)
+# endif
+#pragma clang diagnostic pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include(<uchar.h>)
+# include <uchar.h>
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+#if !defined(SWIFT_RUNTIME_NAME)
+# if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+# else
+# define SWIFT_RUNTIME_NAME(X)
+# endif
+#endif
+#if !defined(SWIFT_COMPILE_NAME)
+# if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+# else
+# define SWIFT_COMPILE_NAME(X)
+# endif
+#endif
+#if !defined(SWIFT_METHOD_FAMILY)
+# if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+# else
+# define SWIFT_METHOD_FAMILY(X)
+# endif
+#endif
+#if !defined(SWIFT_NOESCAPE)
+# if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+# else
+# define SWIFT_NOESCAPE
+# endif
+#endif
+#if !defined(SWIFT_RELEASES_ARGUMENT)
+# if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+# else
+# define SWIFT_RELEASES_ARGUMENT
+# endif
+#endif
+#if !defined(SWIFT_WARN_UNUSED_RESULT)
+# if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+# else
+# define SWIFT_WARN_UNUSED_RESULT
+# endif
+#endif
+#if !defined(SWIFT_NORETURN)
+# if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+# else
+# define SWIFT_NORETURN
+# endif
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if !defined(SWIFT_DEPRECATED_OBJC)
+# if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+# else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+# endif
+#endif
+#if defined(__OBJC__)
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#endif
+#if !defined(SWIFT_EXTERN)
+# if defined(__cplusplus)
+# define SWIFT_EXTERN extern "C"
+# else
+# define SWIFT_EXTERN extern
+# endif
+#endif
+#if !defined(SWIFT_CALL)
+# define SWIFT_CALL __attribute__((swiftcall))
+#endif
+#if !defined(SWIFT_INDIRECT_RESULT)
+# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result))
+#endif
+#if !defined(SWIFT_CONTEXT)
+# define SWIFT_CONTEXT __attribute__((swift_context))
+#endif
+#if !defined(SWIFT_ERROR_RESULT)
+# define SWIFT_ERROR_RESULT __attribute__((swift_error_result))
+#endif
+#if defined(__cplusplus)
+# define SWIFT_NOEXCEPT noexcept
+#else
+# define SWIFT_NOEXCEPT
+#endif
+#if !defined(SWIFT_C_INLINE_THUNK)
+# if __has_attribute(always_inline)
+# if __has_attribute(nodebug)
+# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug))
+# else
+# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline))
+# endif
+# else
+# define SWIFT_C_INLINE_THUNK inline
+# endif
+#endif
+#if defined(_WIN32)
+#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
+# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport)
+#endif
+#else
+#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
+# define SWIFT_IMPORT_STDLIB_SYMBOL
+#endif
+#endif
+#if defined(__OBJC__)
+#if __has_feature(objc_modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+#endif
+
+#endif
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="JoyGemAI",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+#if defined(__OBJC__)
+#endif
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#if defined(__cplusplus)
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#else
+#error unsupported Swift architecture
+#endif
--- /dev/null
+//
+// JoyGemAI.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+//! Project version number for JoyGemAI.
+FOUNDATION_EXPORT double JoyGemAIVersionNumber;
+
+//! Project version string for JoyGemAI.
+FOUNDATION_EXPORT const unsigned char JoyGemAIVersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import <JoyGemAI/PublicHeader.h>
+
+#import <JoyGemAI/JoyGemAIManager.h>
+#import <JoyGemAI/JoyGemParam.h>
+#import <JoyGemAI/JoyGemModel.h>
+#import <JoyGemAI/JoyGemChatManager.h>
+#import <JoyGemAI/JoyGemSIManager.h>
+#import <JoyGemAI/JoyGemSIDeviceManager.h>
+#import <JoyGemAI/JoyGemRecordManager.h>
+#import <JoyGemAI/JoyGemCallManager.h>
+#import <JoyGemAI/JoyGemEnum.h>
+#import <JoyGemAI/JoyGemDeviceManager.h>
--- /dev/null
+//
+// JoyGemAIManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreBluetooth/CoreBluetooth.h>
+#import <JoyGemAI/JoyGemParam.h>
+#import <JoyGemAI/JoyGemModel.h>
+#import <JoyGemAI/JoyGemEnum.h>
+#import <SocketRocket/SocketRocket.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol JoyGemAIManagerDelegate <NSObject>
+
+/// 鉴权成功时回调
+-(void)joyGemAuthSuccessCallback;
+
+/// 鉴权失败时回调
+-(void)joyGemAuthFailedCallback;
+
+/// AI\b耳机动作回调
+/// - NOTE: 对话相关动作是通知,即消息来时已经发生,录音相关动作是请求,即耳机没有实际操作
+@optional
+-(void)joyGemAction:(JoyGemActionMode)action;
+
+@end
+
+@protocol JoyGemAIManagerDataSource <NSObject>
+
+///实现该方法,将数据转发给蓝牙
+@required
+-(void)joyGemSendData:(NSData*)data withCharacteristic:(CBCharacteristic*)characteristic;
+
+@end
+
+@class JoyGemDeviceManager;
+
+@interface JoyGemAIManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemAIManagerDelegate> delegate;
+@property(nonatomic, weak) id<JoyGemAIManagerDataSource> dataSource;
+
+@property(nonatomic, strong) JoyGemDeviceManager *device;
+
+// 实例对象
++ (instancetype)shared;
+
+/// 初始化sdk
+- (void)initSdk;
+
+/// 日志打印级别
+/// - Parameter level: 日志等级 分为关闭,简略,完全
+- (void)setLogMode:(JoyGemLogMode)mode;
+
+/// 日志存储路径
+/// - Parameter path: 日志存储文件路径
+/// - Description: 为空时不进行日志存储, 不支持多次配置
+- (void)setLogPath:(nullable NSString*)path;
+
+/// 传入蓝牙服务对象
+/// - Parameters:
+/// - service: 服务对象
+/// - characteristics: 需要\bnotify的特征
+/// - Returns: 是否正确的配置了相关服务特征
+/// - Description: Block为同步操作
+- (BOOL)configService:(CBService*)service needNotify:(void (^)(NSArray<CBCharacteristic*>*))characteristics;
+
+/// 收到蓝牙设备传过来的数据,调用此方法交给sdk处理
+/// - Parameter characteristic:更新的特征
+- (void)receiveValue:(CBCharacteristic *)characteristic;
+
+/// 蓝牙设备已连接
+- (void)bleConnected;
+
+/// 蓝牙断开连接
+- (void)bleDisConnected;
+
+/// SDK文件存储文件夹
+/// - Parameter path: SDK文件存储路径(SDK需要用到文件存储时所指向的路径)
+- (void)setCacheDirectory:(nullable NSString*)path;
+
+/// 清除临时文件
+/// - Description: 只会清除当前配置路径下的文件
+- (void)clearCacheDirectory;
+
+/// \bTWS耳机主从切换时是否尝试当前AI功能自动延续
+/// - Parameters:
+/// - enable: 默认为false
+-(void)setTWSAutoSync:(BOOL)enable;
+
+-(void)setTextAutoSync:(BOOL)enable;
+
+-(void)setEmotionAutoSync:(BOOL)enable;
+
+/// 文本翻译
+/// - Parameters:
+/// - text: 翻译的文字
+/// - fromLanguage: 原始语言
+/// - toLanguage: 翻译语言
+/// - stream: 结果回调
+/// - error: 错误回调
+/// - Description: 最大文本支持30K
+- (void)translate:(NSString *)text from:(NSString*)fromLanguage to:(NSString*)toLanguage stream:(void (^)(NSString* llmResponse,BOOL finish))stream error:(void (^)( NSError * _Nullable err))error;
+
+/// 取消文本翻译
+-(void)cancelTranslateRequest;
+
+/// 文本摘要
+/// - Parameters:
+/// - text: 摘要的文字
+/// - stream: 结果回调
+/// - error: 错误回调
+/// - Description: 最大文本支持30K
+- (void)summary:(NSString *)text stream:(void (^)(NSString* llmResponse,BOOL finish))stream error:(void (^)( NSError * _Nullable err))error;
+
+/// 取消文本摘要
+-(void)cancelSummaryRequest;
+
+
+/// 设置同传的tts回应速度
+/// - Parameters:
+/// - speed: 默认1.0,范围[0.8,2]
+-(void)setTtsSpeed:(float)speed;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemCallController.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/7/12.
+//
+
+#import <UIKit/UIKit.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemCallManager;
+@class JoyGemAsrModel;
+
+//通话录音的委托类
+@protocol JoyGemCallManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@optional
+-(void)callManager:(JoyGemCallManager*)manager didUpdateAsr:(JoyGemAsrModel*)model DEPRECATED_MSG_ATTRIBUTE("Use callManager:didUpdateMonoAsr instead \bif supportStereo is false");;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)callManager:(JoyGemCallManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)callManager:(JoyGemCallManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)callManager:(JoyGemCallManager*)manager onError:(JoyGemErrorCode)code;
+
+/// 通话录音开启时,不处于通话状态
+/// - Description: 需要确认耳机是否支持该判断,如果耳机不支持将不会收到回调
+@optional
+-(void)callManagerNotonCall:(JoyGemCallManager*)manager;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)callManagerStopped:(JoyGemCallManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)callManagerCompleted:(JoyGemCallManager*)manager;
+
+@end
+
+@protocol JoyGemCallMonoDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)callManager:(JoyGemCallManager*)manager didUpdateMonoAsr:(JoyGemAsrModel*)model;
+
+@end
+
+@protocol JoyGemCallStereoDelegate <NSObject>
+
+///录音文字识别
+/// - Parameters:
+/// - model: asr识别的对象
+/// - index: 声道序号 1,2
+@required
+-(void)callManager:(JoyGemCallManager*)manager didUpdateStereoAsr:(JoyGemAsrModel*)model channel:(NSUInteger)index;
+
+
+@end
+
+
+/// 通话录音的管理类
+@interface JoyGemCallManager : NSObject
+
+/// 委托类
+/// - Description: 通话录音状态委托
+@property(nonatomic, weak) id<JoyGemCallManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 是否正在录音
+@property(nonatomic, assign) BOOL isRecording;
+
+/// 是否支持立体声录音
+/// - NOTE:鉴权后再使用该字段
+@property(nonatomic, assign ,readonly) BOOL supportStereo;
+
+/// 单声道委托
+/// - Description: 固件支持单声道通话录音时会通过此委托进行回调
+@property(nonatomic, weak) id<JoyGemCallMonoDelegate> monoDelegate;
+
+/// 立体声委托
+/// - Description: 固件支持双声道通话录音时会通过此委托进行回调
+@property(nonatomic, weak) id<JoyGemCallStereoDelegate> stereoDelegate;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开始通话录音
+- (void)start;
+
+/// 结束通话录音
+- (void)stop;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemChatManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+@class JoyGemChatManager;
+@class JoyGemSpeaker;
+
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol JoyGemChatManagerDelegate <NSObject>
+
+///AI语音接收
+/// - Parameters:
+/// - data: 音频数据 pcm格式
+-(void)chatManager:(JoyGemChatManager*)manager audioData:(nullable NSData*)data finish:(BOOL)isFinish;
+
+///用户语音识别
+/// - Parameters:
+/// - text: 文字数据
+/// - index: 语句ID
+-(void)chatManager:(JoyGemChatManager*)manager requestText:(nullable NSString*)text index:(NSUInteger)index;
+
+///AI语音识别
+/// - Parameters:
+/// - text: 文字数据
+/// - index: 语句ID
+/// - isFinish\b:单次对话结束
+-(void)chatManager:(JoyGemChatManager*)manager responseText:(nullable NSString*)text index:(NSUInteger)index finish:(BOOL)isFinish;
+
+///对话状态回调
+/// - Parameters:
+/// - code: 状态变化
+@optional
+-(void)chatManager:(JoyGemChatManager*)manager stateChange:(JoyGemStateCode)code DEPRECATED_MSG_ATTRIBUTE("Use chatManager:eventUpdate instead");
+
+///对话事件回调
+/// - Parameters:
+/// - event: 对话相关事件回调
+/// - NOTE: 需要相关固件支持
+@optional
+-(void)chatManager:(JoyGemChatManager*)manager eventUpdate:(JoyGemChatEvent)event;
+
+/// 错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)chatManager:(JoyGemChatManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+//AI对话的管理类
+@interface JoyGemChatManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemChatManagerDelegate> delegate;
+
+//是否正在对话录音中
+@property(nonatomic, assign) BOOL isRecording;
+
+///是否正在活跃中
+/// - NOTE:可以采用KVO的方式监听该对象, 单次对话不会造成该状态改变
+@property(atomic, assign) BOOL isActive DEPRECATED_MSG_ATTRIBUTE("Use chatManager:eventUpdate instead \bif supportEvent is\b true");
+
+///是否支持事件上报模式
+/// - NOTE:鉴权后再使用该字段
+@property(nonatomic,assign,readonly) BOOL supportEvent;
+
+// 实例对象
++ (instancetype)shared;
+
+/// 开启单次对话
+/// - Note: 如正在播报,需要提前关闭tts后再调用,否则开启无效
+/// - TODO: 待容错处理
+- (void)startSingleChat;
+
+/// 结束单次对话
+/// - Note:请勿在开启单次对话后立刻调用该方法,否则耳机可能不会处理该次请求
+/// - TODO: 待容错处理
+- (void)stopSingleChat;
+
+/// 开启连续对话
+- (void)startChat;
+
+/// 结束连续对话
+- (void)stopChat;
+
+/// 播放音频开始前需要调用此方法告诉耳机
+- (void)playAudioStart;
+
+/// 播放音频结束时需要调用此方法告诉耳机
+/// - Description: 如果处于连续对话状态,则在调用该方法后会直接开启下一轮对话
+- (void)playAudioEnd;
+
+///获取支持角色列表
+/// - Parameters:
+/// - list: 角色列表
+-(void)getSpeakerList:(void (^)(NSArray<JoyGemSpeaker *>*))list;
+
+///配置当前角色
+-(void)setSpeaker:(JoyGemSpeaker*)speaker;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemDeviceManager.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/9/1.
+//
+
+#import <Foundation/Foundation.h>
+#import "JoyGemEnum.h"
+#import "JoyGemModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface JoyGemDeviceManager : NSObject
+
+@property(nonatomic,assign) BOOL twsStatus;
+
+/// 获取mac地址
+/// - Returns:
+/// - edrAddress: 经典蓝牙地址
+/// - bleAddress: ble蓝牙地址
+-(void)macAddress:(void (^)(NSString* edrAddress,NSString* bleAddress))address error:(void (^)( NSError * _Nullable err))error;
+
+/// 获取软件版本
+/// - Returns:
+/// - version: 软件版本
+-(void)software:(void (^)(NSString* version))infomation error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 设置电量监听
+/// - Parameters:
+/// - left: 左耳电量
+/// - right: 右耳电量
+/// - Description: 电量范围为0~100,当未获取到电量时,电量为-1,配置回调时,如果有历史数据,会返回最后的历史数据,耳机会在电量变更时主动上报数据
+-(void)setBatteryListener:(void (^)(NSInteger left, NSInteger right))batteryListener;
+
+/// 主动获取电量
+-(void)updateBattery;
+
+/// 设置耳机状态监听
+/// - Parameters:
+/// - btConnected: 经典蓝牙连接状态
+/// - twsConnected : 双耳模式连接状态
+/// - Description: 部分设置需要在双耳模式下才能生效
+-(void)setStatusListener:(void (^)(BOOL btConnected,BOOL twsConnected))statusListener;
+
+/// 主动获取耳机状态
+-(void)updateStatus;
+
+/// 设置VAD打断状态
+/// - Parameters:
+/// - isOpen: VAD打断是否开启
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setVADInterruptedStatus:(BOOL)isOpen callback:(void (^)( NSError * _Nullable err))error;
+
+/// 获取VAD打断状态
+/// - Returns:
+/// - status: VAD打断是否开启
+-(void)getVADInterruptedStatus:(void (^)(BOOL isOpen))status error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 设置EQ模式
+/// - Parameters:
+/// - mode: \bEQ模式
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setEQMode:(JoyGemEQMode)mode callback:(void (^)( NSError * _Nullable err))error;
+
+/// 获取EQ模式
+/// - Returns:
+/// - mode: VAD打断是否开启
+-(void)getEQMode:(void (^)(JoyGemEQMode mode))mode error:(void (^)( NSError * _Nullable err))error;
+
+/// 设置自定义EQ
+/// - Parameters:
+/// - index: 频段 范围为0~9
+/// - gain: 增益 范围为 -12~12
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setCustomEQ:(NSUInteger)index withGain:(NSInteger)gain callback:(void (^)( NSError * _Nullable err))error;
+
+/// 重置自定义EQ
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)resetCustomEQ:(void (^)( NSError * _Nullable err))error;
+
+/// 获取自定义EQ
+/// - Returns:
+/// - custom: 自定义EQ类型
+-(void)getCustomEQ:(void (^)(JoyGemCustomEQ*))custom error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 查找耳机
+/// - Parameters:
+/// - mode: 查找耳机命令类型
+-(void)findHeadphone:(JoyGemFindHeadphoneMode)mode callback:(void (^)( NSError * _Nullable err))error;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemAIEnum.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#ifndef JoyGemAIEnum_h
+#define JoyGemAIEnum_h
+
+/// 状态变化
+typedef NS_OPTIONS(NSInteger,JoyGemStateCode) {
+ JoyGemStateCodeStartRecord = 1001,///开始录音
+ JoyGemStateCodeStopRecord = 1002,///停止录音
+ JoyGemStateCodeWebsocketConnected = 3001,///socket连上
+ JoyGemStateCodeWebsocketDisconnected = 3002,///socket断开连接
+};
+
+/// 错误
+typedef NS_OPTIONS(NSInteger,JoyGemErrorCode) {
+ JoyGemErrorCodeRecordError = 1003,///录音出错
+ JoyGemErrorCodeNetError = 3003,///网络错误
+ JoyGemErrorCodeUnAuth = 9999,///未鉴权
+};
+
+/// 录音类型
+typedef NS_ENUM(NSUInteger, JoyGemRecordMode) {
+ JoyGemRecordModeLive = 1, ///现场录音
+ JoyGemRecordModeCall = 2, ///通话录音
+};
+
+/// 日志类型
+typedef NS_ENUM(NSUInteger, JoyGemLogMode) {
+ JoyGemLogModeClose, ///关闭日志
+ JoyGemLogModeSimple, ///简略日志
+ JoyGemLogModeAll, ///完整日志
+};
+
+/// 动作类型
+typedef NS_ENUM(NSUInteger, JoyGemActionMode) {
+ JoyGemActionModeCancel = 0, ///关闭当前AI功能
+ JoyGemActionModeRecordLive = 1, ///现场录音
+ JoyGemActionModeRecordCall = 2, ///通话录音
+ JoyGemActionModeSi = 3, ///同声传译
+ JoyGemActionModeChat = 4, ///AI对话
+};
+
+/// 录音结束类型
+typedef NS_ENUM(NSUInteger, JoyGemRecordStopCode) {
+ JoyGemRecordStopCodeActively = 0, ///用户主动关闭录音
+ JoyGemRecordStopCodePassively = 1, ///用户被动关闭录音
+};
+
+
+/// 对话事件类型
+typedef NS_ENUM(NSUInteger, JoyGemChatEvent) {
+ JoyGemChatEventIdle = 0, /// 空闲中
+ JoyGemChatEventBegin, /// 开始对话(单轮对话不会产生该事件)
+ JoyGemChatEventEnd, /// 结束对话(单轮对话不会产生该事件)
+ JoyGemChatEventNewRound, /// 开始新一轮对话
+ JoyGemChatEventRecording, /// 录音中
+ JoyGemChatEventRspWaiting, /// 等待中
+ JoyGemChatEventPlaying, /// 正在播放声音
+ JoyGemChatEventPlayEnd, /// 结束播放声音
+};
+
+/// EQ类型
+typedef NS_ENUM(NSUInteger, JoyGemEQMode) {
+ JoyGemEQModeNormal, ///普通
+ JoyGemEQModeRock, ///摇滚
+ JoyGemEQModePop, ///流行
+ JoyGemEQModeClassic, ///经典
+ JoyGemEQModeJazz, ///爵士
+ JoyGemEQModeCustom, ///自定义
+};
+
+
+/// EQ类型
+typedef NS_ENUM(NSUInteger, JoyGemFindHeadphoneMode) {
+ JoyGemFindHeadphoneModeCancel, ///关闭查找耳机
+ JoyGemFindHeadphoneModeLeft, ///查找左耳
+ JoyGemFindHeadphoneModeRight, ///查找右耳
+ JoyGemFindHeadphoneModeAll, ///查找双耳
+};
+
+#endif /* JoyGemAIEnum_h */
--- /dev/null
+//
+// JoyGemAIModel.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+///AI对话角色
+@interface JoyGemSpeaker : NSObject
+
+@property (nonatomic, strong) NSString *sid;/// 音色id
+@property (nonatomic, strong) NSString *name;/// 名称
+@property (nonatomic, strong) NSString *type;/// 类型
+@property (nonatomic, strong) NSString *role;/// 角色
+
+@end
+
+
+///ASR对象
+@interface JoyGemAsrModel : NSObject
+
+@property (nonatomic, strong) NSString *text; /// 文本
+@property (nonatomic, assign) NSUInteger index; /// 序号
+@property (nonatomic, assign) BOOL definite; /// 片段化确定(不建议作为断句标识)
+
+@end
+
+///自定义EQ设置对象
+@interface JoyGemCustomEQ : NSObject
+
+@property (nonatomic, strong) NSArray<NSNumber*> *bands;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemAIParam.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+///MARK: 语音语言
+
+//自动识别中英
+extern NSString* const kJoyGemAILocalizationAuto;
+
+//简体中文 zh-CN
+extern NSString* const kJoyGemAILocalizationZH;
+
+//英文 en-US
+extern NSString* const kJoyGemAILocalizationEN;
+
+//日语 ja-JP
+extern NSString* const kJoyGemAILocalizationJA;
+
+//韩语 ko-KR
+extern NSString* const kJoyGemAILocalizationKO;
+
+//法语 fr-FR
+extern NSString* const kJoyGemAILocalizationFR;
+
+//西班牙语 es-MX
+extern NSString* const kJoyGemAILocalizationES;
+
+//葡萄牙语 pt-BR
+extern NSString* const kJoyGemAILocalizationPT;
+
+//印尼语 id-ID
+extern NSString* const kJoyGemAILocalizationID;
+
+//俄语 ru-RU
+extern NSString* const kJoyGemAILocalizationRU;
+
+//马来语 ms-MY
+extern NSString* const kJoyGemAILocalizationMS;
+
+///MARK: 蓝牙相关
+///
+///AI功能使用的蓝牙服务
+extern NSString* const kJoyGemAIServiceUUID;
+
+extern NSString* const kJoyGemAICharacteristicNotifyUUID;
+
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemRecordManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemRecordManager;
+@class JoyGemAsrModel;
+
+//现场录音的委托类
+@protocol JoyGemRecordManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)recordManager:(JoyGemRecordManager*)manager didUpdateAsr:(JoyGemAsrModel*)model;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)recordManager:(JoyGemRecordManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)recordManager:(JoyGemRecordManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)recordManager:(JoyGemRecordManager*)manager onError:(JoyGemErrorCode)code;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)recordManagerStopped:(JoyGemRecordManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应,
+@optional
+-(void)recordManagerCompleted:(JoyGemRecordManager*)manager;
+
+@end
+
+/// 现场录音的管理类
+@interface JoyGemRecordManager : NSObject
+
+/// 委托类
+@property(nonatomic, weak) id<JoyGemRecordManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 是否正在暂停中
+@property(nonatomic,assign) BOOL isPause;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开启现场录音
+- (void)start;
+
+/// 结束现场录音
+- (void)stop;
+
+/// 暂停录音
+- (void)pause;
+
+/// 恢复录音
+- (void)resume;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemSIDeviceManager.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/5/21.
+//
+
+#import <UIKit/UIKit.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemSIDeviceManager;
+@class JoyGemAsrModel;
+
+/// 同声传译(设备)的管理类
+@protocol JoyGemSIDeviceManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateRaw:(JoyGemAsrModel*)model;
+
+///录音文字翻译时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateTranslate:(JoyGemAsrModel*)model;
+
+///音频数据更新时
+/// - Parameters:
+/// - data: 流数据 pcm格式
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateAudioData:(NSData*)data;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)siDeviceManagerStopped:(JoyGemSIDeviceManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)siDeviceManagerCompleted:(JoyGemSIDeviceManager*)manager;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+/// 同声传译(设备)的管理类
+@interface JoyGemSIDeviceManager : NSObject
+
+/// 委托类
+@property(nonatomic, weak) id<JoyGemSIDeviceManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 耳机输出语言
+@property(nonatomic, strong) NSString* targetLanguage;
+
+/// 是否正在录音
+@property(nonatomic,assign) BOOL isRecording;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开始同声传译(设备)
+- (void)start;
+
+/// 结束同声传译(设备)
+- (void)stop;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemSIManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+@class JoyGemSIManager;
+@class JoyGemAsrModel;
+
+NS_ASSUME_NONNULL_BEGIN
+
+//同声传译的委托类
+@protocol JoyGemSIManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateRaw:(JoyGemAsrModel*)model;
+
+///录音文字翻译时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateTranslate:(JoyGemAsrModel*)model;
+
+///音频数据更新时
+/// - Parameters:
+/// - data: 流数据 pcm格式
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateAudioData:(NSData*)data;
+
+///录音状态切换时
+-(void)siManager:(JoyGemSIManager*)manager stateChange:(JoyGemStateCode)code;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)siManagerStopped:(JoyGemSIManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)siManagerCompleted:(JoyGemSIManager*)manager;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)siManager:(JoyGemSIManager*)manager saveFile:(NSString*)path;
+
+/// 错误回调
+-(void)siManager:(JoyGemSIManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+/// 同声传译的管理类
+@interface JoyGemSIManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemSIManagerDelegate> delegate;
+
+///原始语言
+///目前原始语言设置无效,默认为kJoyGemAILocalizationAuto
+@property(nonatomic, strong) NSString* originalLanguage;
+
+///目标语言
+///默认为kJoyGemAILocalizationAuto,可以设置为中文或者英文
+@property(nonatomic, strong) NSString* targetLanguage;
+
+/// 是否正在录音
+@property(nonatomic,assign) BOOL isRecording;
+
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开启同声传译
+- (void)start;
+
+/// 结束同声传译
+- (void)stop;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
+
--- /dev/null
+{
+ "ABIRoot": {
+ "kind": "Root",
+ "name": "JoyGemAI",
+ "printedName": "JoyGemAI",
+ "children": [
+ {
+ "kind": "Import",
+ "name": "Foundation",
+ "printedName": "Foundation",
+ "declKind": "Import",
+ "moduleName": "JoyGemAI",
+ "declAttributes": [
+ "RawDocComment"
+ ]
+ }
+ ],
+ "json_format_version": 8
+ },
+ "ConstValues": []
+}
\ No newline at end of file
--- /dev/null
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+// swift-module-flags: -target arm64-apple-ios13.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name JoyGemAI
+// swift-module-flags-ignorable: -no-verify-emitted-module-interface
+import Foundation
+@_exported import JoyGemAI
+import Swift
+import _Concurrency
+import _StringProcessing
+import _SwiftConcurrencyShims
--- /dev/null
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+// swift-module-flags: -target arm64-apple-ios13.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name JoyGemAI
+// swift-module-flags-ignorable: -no-verify-emitted-module-interface
+import Foundation
+@_exported import JoyGemAI
+import Swift
+import _Concurrency
+import _StringProcessing
+import _SwiftConcurrencyShims
--- /dev/null
+framework module JoyGemAI {
+ umbrella header "JoyGemAI.h"
+ export *
+
+ module * { export * }
+}
+
+module JoyGemAI.Swift {
+ header "JoyGemAI-Swift.h"
+ requires objc
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSPrivacyTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypes</key>
+ <array>
+ <dict>
+ <key>NSPrivacyCollectedDataType</key>
+ <string>NSPrivacyCollectedDataTypeAudioData</string>
+ <key>NSPrivacyCollectedDataTypeLinked</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypeTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypePurposes</key>
+ <array>
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
+ </array>
+ </dict>
+ </array>
+ <key>NSPrivacyTrackingDomains</key>
+ <array/>
+ <key>NSPrivacyAccessedAPITypes</key>
+ <array/>
+</dict>
+</plist>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>files</key>
+ <dict>
+ <key>Headers/JoyGemAI-Swift.h</key>
+ <data>
+ EzwLstWsXu+VfPMQanIZDbX3a0E=
+ </data>
+ <key>Headers/JoyGemAI.h</key>
+ <data>
+ 8NnRIJGe/ATf7a6jdPAfly29UC4=
+ </data>
+ <key>Headers/JoyGemAIManager.h</key>
+ <data>
+ Oq+OIkczOsgav5Qo1BqTz/1gc4M=
+ </data>
+ <key>Headers/JoyGemCallManager.h</key>
+ <data>
+ BWJeSQyHYVE1TwiSgvXYhNdyJXI=
+ </data>
+ <key>Headers/JoyGemChatManager.h</key>
+ <data>
+ EOl/+6HcGPZVHgre1chnDptuCBU=
+ </data>
+ <key>Headers/JoyGemDeviceManager.h</key>
+ <data>
+ h7T4t0GUmAg2ZHyPU+Sn7lQrkw0=
+ </data>
+ <key>Headers/JoyGemEnum.h</key>
+ <data>
+ M1/juV+sL7ggbp4Y9srW0rq/Dqo=
+ </data>
+ <key>Headers/JoyGemModel.h</key>
+ <data>
+ ZQ5Ie1ErW3QF78XXxz/ydxsSQ5E=
+ </data>
+ <key>Headers/JoyGemParam.h</key>
+ <data>
+ SzxTsmYo/XvsD3Uz2iqjnRDkRnA=
+ </data>
+ <key>Headers/JoyGemRecordManager.h</key>
+ <data>
+ pKeMD6Xg3Br6ZOWB/BxyqAicCfc=
+ </data>
+ <key>Headers/JoyGemSIDeviceManager.h</key>
+ <data>
+ Cn0/thrZRr+pJ+skbuRbfJJirmA=
+ </data>
+ <key>Headers/JoyGemSIManager.h</key>
+ <data>
+ UiwORLtCgzF+QX/hXpK2w63Yx4Q=
+ </data>
+ <key>Info.plist</key>
+ <data>
+ vHVrQqK4ReuQBxyUxqv5BOG8mbw=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
+ <data>
+ jacBwduET4BLcaiJtoJ9sWWXQ6s=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.abi.json</key>
+ <data>
+ iVs2bUNJJDbD/ENi/Q0lo4aP3uk=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
+ <data>
+ BmjRZIKCen7GN8lmcoDVw3R2KvM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftdoc</key>
+ <data>
+ xFskxbeAbkxTqKE8F2wcvY/ElFM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftinterface</key>
+ <data>
+ BmjRZIKCen7GN8lmcoDVw3R2KvM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftmodule</key>
+ <data>
+ 4QozN8a+2xPGGnyDrUz/2Hg7JPI=
+ </data>
+ <key>Modules/module.modulemap</key>
+ <data>
+ qguEoXSNM0mFX+7WmMXUO3TTSLk=
+ </data>
+ <key>PrivacyInfo.xcprivacy</key>
+ <data>
+ SRctDO3cqibONLEG7CPcNZVBnXw=
+ </data>
+ </dict>
+ <key>files2</key>
+ <dict>
+ <key>Headers/JoyGemAI-Swift.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ D6FOg3LxVu6AQ3xMxdtxm8TsqeXBLCKYS1SQ1weJXno=
+ </data>
+ </dict>
+ <key>Headers/JoyGemAI.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ nO8YFPNcoOIKUrpS9Pd4/T9V98f16ACbB7LFROxEPhQ=
+ </data>
+ </dict>
+ <key>Headers/JoyGemAIManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ IThULWmQt2RS9f8uhIVCj/9ZZKa5G20vUaJzCby0P9U=
+ </data>
+ </dict>
+ <key>Headers/JoyGemCallManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 4aqJC5wgayXjaD7XHafngtRL7PSKbqPdFujG27R7l4Q=
+ </data>
+ </dict>
+ <key>Headers/JoyGemChatManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 4ZkuysTzaFha4/myXFF57XtlqM0e4bMJIZlamlMNqm8=
+ </data>
+ </dict>
+ <key>Headers/JoyGemDeviceManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ zMSjXsvAeHKCWlyAIRTc/D/BYBU8crV81VAMtiRCNZA=
+ </data>
+ </dict>
+ <key>Headers/JoyGemEnum.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 6xL0kb6k/tdSxOKLIazlAA2o8gm1ZE3njRHg40EOYMw=
+ </data>
+ </dict>
+ <key>Headers/JoyGemModel.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ rFoRM/fmnvDGWCISlMyWSioYrwvoetaKOU8WrgOCBNw=
+ </data>
+ </dict>
+ <key>Headers/JoyGemParam.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ oXJjxfeaUmV4FnIP5DUB7MLED0QsP5hp0v0AqO8ttMs=
+ </data>
+ </dict>
+ <key>Headers/JoyGemRecordManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ C4rHebQlX6cKQWVmjh1cDetbe6cC+glcl2deSRF3r/o=
+ </data>
+ </dict>
+ <key>Headers/JoyGemSIDeviceManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ bkQU7XO+s/wbDHlWf9VM2kvGxB5myT2n0bEp+ac6tHo=
+ </data>
+ </dict>
+ <key>Headers/JoyGemSIManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 5nObgPQx+QBZs8lbacCMnhBUJs629P/ZuVFJytUIV44=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ ppJvM28BX4SQ+Bp40K+I9948VA34G8v2sowJEtO80vQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.abi.json</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ li11LC5FIVL81dorkSyLKnyNa2JtjEuBDo/IzoAeVCU=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ c9qIPe1Wqd1NpKlpuawO+ORLNw5ws9/SFWK8GiWvotQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftdoc</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ lFffbgJPWht+xRXKPA4Nv2rrNTUSt2wtt9PtaTTwK6w=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftinterface</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ c9qIPe1Wqd1NpKlpuawO+ORLNw5ws9/SFWK8GiWvotQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftmodule</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ oIPD6jOI3lmqwRw8fQIjIdbh/igLDvY7QXuX2vHol4M=
+ </data>
+ </dict>
+ <key>Modules/module.modulemap</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ EYrXhwPscfz6NC5xiiSHpFYdSR7Z5+JCyV2sAnxwmPc=
+ </data>
+ </dict>
+ <key>PrivacyInfo.xcprivacy</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ cuaVRkQIQRl8fLAPRH2XlUdsPxO0W90uL0WcSHvmSnY=
+ </data>
+ </dict>
+ </dict>
+ <key>rules</key>
+ <dict>
+ <key>^.*</key>
+ <true/>
+ <key>^.*\.lproj/</key>
+ <dict>
+ <key>optional</key>
+ <true/>
+ <key>weight</key>
+ <real>1000</real>
+ </dict>
+ <key>^.*\.lproj/locversion.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>1100</real>
+ </dict>
+ <key>^Base\.lproj/</key>
+ <dict>
+ <key>weight</key>
+ <real>1010</real>
+ </dict>
+ <key>^version.plist$</key>
+ <true/>
+ </dict>
+ <key>rules2</key>
+ <dict>
+ <key>.*\.dSYM($|/)</key>
+ <dict>
+ <key>weight</key>
+ <real>11</real>
+ </dict>
+ <key>^(.*/)?\.DS_Store$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>2000</real>
+ </dict>
+ <key>^.*</key>
+ <true/>
+ <key>^.*\.lproj/</key>
+ <dict>
+ <key>optional</key>
+ <true/>
+ <key>weight</key>
+ <real>1000</real>
+ </dict>
+ <key>^.*\.lproj/locversion.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>1100</real>
+ </dict>
+ <key>^Base\.lproj/</key>
+ <dict>
+ <key>weight</key>
+ <real>1010</real>
+ </dict>
+ <key>^Info\.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^PkgInfo$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^embedded\.provisionprofile$</key>
+ <dict>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^version\.plist$</key>
+ <dict>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ </dict>
+</dict>
+</plist>
PODS:
- Alamofire (5.10.2)
+ - DGActivityIndicatorView (2.1.1)
- FDFullscreenPopGesture (1.1)
- FSPagerView (0.8.3)
- HandyJSON (5.0.2)
- RealmSwift (20.0.3):
- Realm (= 20.0.3)
- SnapKit (5.7.1)
+ - SocketRocket (0.7.1)
- SVProgressHUD (2.3.1):
- SVProgressHUD/Core (= 2.3.1)
- SVProgressHUD/Core (2.3.1)
- YYText (1.0.7)
DEPENDENCIES:
+ - DGActivityIndicatorView
- FDFullscreenPopGesture
- FSPagerView
- HandyJSON
- netfox
- RealmSwift
- SnapKit
+ - SocketRocket
- SVProgressHUD
- SwiftDate
- swiftScan
SPEC REPOS:
https://gitee.com/mirrors/CocoaPods-Specs.git:
- Alamofire
+ - DGActivityIndicatorView
- FDFullscreenPopGesture
- FSPagerView
- HandyJSON
- Realm
- RealmSwift
- SnapKit
+ - SocketRocket
- SVProgressHUD
- SwiftDate
- swiftScan
SPEC CHECKSUMS:
Alamofire: 7193b3b92c74a07f85569e1a6c4f4237291e7496
+ DGActivityIndicatorView: ff2c76073d79692f724863c8dd38685866a03cb6
FDFullscreenPopGesture: a8a620179e3d9c40e8e00256dcee1c1a27c6d0f0
FSPagerView: 670405b2f18e2a87fa37f20b00de783e562c25a8
HandyJSON: 9e4e236f5d2dbefad5155a77417bbea438201c03
Realm: 853e5089d6042dff807bda000277eadfe2da93d2
RealmSwift: f33c19577cefcbf681345d721fcbc7b42be4c949
SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
+ SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
SwiftDate: bbc26e26fc8c0c33fbee8c140c5e8a68293a148a
swiftScan: 0849e7d7c1c641384767a573ee8cb90b88d1ddd9
YYModel: 2a7fdd96aaa4b86a824e26d0c517de8928c04b30
YYText: 5c461d709e24d55a182d1441c41dc639a18a4849
-PODFILE CHECKSUM: f323e3f6f056168efd0723b2cefc34a0a50bde82
+PODFILE CHECKSUM: 3ae5b0826c9764636aac77b04720df3c8e87c203
COCOAPODS: 1.16.2
objects = {
/* Begin PBXBuildFile section */
+ 3F79C6142E6055E500EC38B9 /* JoyGemAI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3F79C4902E603B4700EC38B9 /* JoyGemAI.framework */; };
+ 3F79C6152E6055E500EC38B9 /* JoyGemAI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3F79C4902E603B4700EC38B9 /* JoyGemAI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
F2E449CAD5874BE652A69B50 /* Pods_ShenYin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3862D5561144E20721225B96 /* Pods_ShenYin.framework */; };
/* End PBXBuildFile section */
+/* Begin PBXCopyFilesBuildPhase section */
+ 3F79C6162E6055E500EC38B9 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 3F79C6152E6055E500EC38B9 /* JoyGemAI.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
/* Begin PBXFileReference section */
3862D5561144E20721225B96 /* Pods_ShenYin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_ShenYin.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 3F79C4902E603B4700EC38B9 /* JoyGemAI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JoyGemAI.framework; sourceTree = "<group>"; };
3F887B9C2E38D8DC00C98658 /* ShenYin.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = ShenYin.app; sourceTree = BUILT_PRODUCTS_DIR; };
5F5DE5910965D53C2B3405B0 /* Pods-ShenYin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ShenYin.debug.xcconfig"; path = "Target Support Files/Pods-ShenYin/Pods-ShenYin.debug.xcconfig"; sourceTree = "<group>"; };
CB933A7969ADF81D59503790 /* Pods-LingQi.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-LingQi.debug.xcconfig"; path = "Target Support Files/Pods-LingQi/Pods-LingQi.debug.xcconfig"; sourceTree = "<group>"; };
buildActionMask = 2147483647;
files = (
F2E449CAD5874BE652A69B50 /* Pods_ShenYin.framework in Frameworks */,
+ 3F79C6142E6055E500EC38B9 /* JoyGemAI.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
676B86A4BA2639E8694D56B4 /* Frameworks */ = {
isa = PBXGroup;
children = (
+ 3F79C4902E603B4700EC38B9 /* JoyGemAI.framework */,
3862D5561144E20721225B96 /* Pods_ShenYin.framework */,
);
name = Frameworks;
3F887B992E38D8DC00C98658 /* Frameworks */,
3F887B9A2E38D8DC00C98658 /* Resources */,
5A934A35F54A5620CFD3C08A /* [CP] Embed Pods Frameworks */,
+ 3F79C6162E6055E500EC38B9 /* Embed Frameworks */,
);
buildRules = (
);
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = M33X987285;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)",
+ );
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShenYin/Info.plist;
+ INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "扫描附近蓝牙设备需要获得权限";
+ INFOPLIST_KEY_NSCameraUsageDescription = "修改用户头像、提交意见反馈需要访问相册使用摄像头";
+ INFOPLIST_KEY_NSMicrophoneUsageDescription = "录音需要使用麦克风";
+ INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "修改用户头像、提交意见反馈需要访问相册";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = M33X987285;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)",
+ );
GENERATE_INFOPLIST_FILE = YES;
INFOPLIST_FILE = ShenYin/Info.plist;
+ INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "扫描附近蓝牙设备需要获得权限";
+ INFOPLIST_KEY_NSCameraUsageDescription = "修改用户头像、提交意见反馈需要访问相册使用摄像头";
+ INFOPLIST_KEY_NSMicrophoneUsageDescription = "录音需要使用麦克风";
+ INFOPLIST_KEY_NSPhotoLibraryUsageDescription = "修改用户头像、提交意见反馈需要访问相册";
INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
INFOPLIST_KEY_UIMainStoryboardFile = Main;
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
- INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = UIInterfaceOrientationPortrait;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = UIInterfaceOrientationPortrait;
IPHONEOS_DEPLOYMENT_TARGET = 13.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
--- /dev/null
+//
+// JoySdkManager.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/28.
+//
+
+import UIKit
+import IQKeyboardManagerSwift
+
+
+class AppLaunch:NSObject{
+ @MainActor static func start(){
+ JoySdkManager.shared.setupSdk()
+ setupKeyboard()
+ }
+
+ @MainActor static func setupKeyboard(){
+ if #available(iOS 15.0, *) {
+ UITableView.appearance().sectionHeaderTopPadding = 0
+ }
+ IQKeyboardManager.shared.enableAutoToolbar = true
+ IQKeyboardManager.shared.isEnabled = true
+ IQKeyboardManager.shared.resignOnTouchOutside = true
+ }
+}
--- /dev/null
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Group_2361@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Group_2361@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Frame_2272@2x(1).png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Frame_2272@3x(1).png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Frame_2273@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Frame_2273@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "tab-扫码_1@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "tab-扫码_1@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Fill 1备份 4@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Fill 1备份 4@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Fill 1@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Fill 1@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "qrcode_scan_btn_photo_down@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "qrcode_scan_btn_photo_nor@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "qrcode_scan_light_green@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "qrcode_scan_light_green@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "qrcode_scan_titlebar_back_nor@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "刷新_(1) 1@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "刷新_(1) 1@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Frame@2x(2).png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Frame@3x(2).png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "scale" : "1x"
+ },
+ {
+ "filename" : "Frame@2x.png",
+ "idiom" : "universal",
+ "scale" : "2x"
+ },
+ {
+ "filename" : "Frame@3x.png",
+ "idiom" : "universal",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+//
+// Untitled.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/28.
+//
+
+import UIKit
+import CoreBluetooth
+import JoyGemAI
+import SVProgressHUD
+import AVFAudio
+class BleManager: NSObject {
+ var discoverDeviceCallback: (([CBPeripheral]) -> Void)?
+ var didConnectDeviceCallback: ((CBPeripheral) -> Void)?
+ var disConnectDeviceCallback: ((CBPeripheral) -> Void)?
+
+ private var centralManager: CBCentralManager!
+ var devices: [CBPeripheral] = []
+ private var connectPeripheral: CBPeripheral?
+
+ private override init() {
+ super.init()
+ centralManager = CBCentralManager(delegate: self, queue: nil)
+ setupJoySdk()
+ }
+
+ static let shared = BleManager()
+
+ func setupJoySdk(){
+ JoyGemAIManager.shared().delegate = self;
+ JoyGemAIManager.shared().dataSource = self;
+ }
+}
+extension BleManager:CBCentralManagerDelegate{
+ func centralManagerDidUpdateState(_ central: CBCentralManager) {
+ switch central.state {
+ case.unknown:
+ break
+ case.resetting:
+ break
+ case.unsupported:
+ break
+ case.unauthorized:
+ break
+ case.poweredOff:
+ break
+ case.poweredOn:
+ startScanDevice()
+ break
+ @unknown default:
+ break
+ }
+ }
+
+ func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
+ if devices.contains(peripheral) {
+ return
+ }
+
+ // DB209A55-DD0E-5031-29FA-40D734C34971
+ // "edr:21140DE4C3D9"
+ // "ble:21140D2CC682"
+ if peripheral.identifier.uuidString != "DB209A55-DD0E-5031-29FA-40D734C34971" {
+ return
+ }
+
+ devices.append(peripheral)
+ print(peripheral)
+ discoverDeviceCallback?(devices)
+ }
+
+ func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
+ stopScanDevice()
+ print("蓝牙已连接 \(peripheral)")
+ connectPeripheral = peripheral
+ peripheral.delegate = self
+ peripheral.discoverServices([CBUUID(string: kJoyGemAIServiceUUID)]);
+ didConnectDeviceCallback?(connectPeripheral!)
+ }
+ func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
+ print("peripheral: %@ failed to connect", peripheral)
+ SVProgressHUD.dismiss()
+ }
+ func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
+ print("蓝牙已断开 \(peripheral)")
+ disConnectDeviceCallback?(peripheral)
+ }
+}
+
+
+extension BleManager: CBPeripheralDelegate {
+
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
+
+ print("发现服务成功")
+ for service in peripheral.services! {
+ print("peripheral service: %@", service)
+ peripheral.discoverCharacteristics(nil, for: service)
+ }
+
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
+ //MARK: 需要配置服务对象
+ if (service.uuid.uuidString == kJoyGemAIServiceUUID) {
+ let success = JoyGemAIManager.shared().configService(service) { chars in
+ for char in chars {
+ debugPrint(char)
+ peripheral.setNotifyValue(true, for: char)
+ }
+ }
+ if (!success) {
+ debugPrint("初始化失败!")
+ }
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
+ if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == kJoyGemAIServiceUUID && characteristic.uuid.uuidString == kJoyGemAICharacteristicNotifyUUID) {
+ //MARK: 使能成功时需要
+ print("特征使能成功")
+ JoyGemAIManager.shared().bleConnected()
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
+ //MARK: 需要配置传入数据
+ JoyGemAIManager.shared().receiveValue(characteristic)
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService]) {
+ // Accessory's GATT database has updated. Refresh your local cache (if any)
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: (any Error)?) {
+
+ }
+
+}
+
+extension BleManager{
+
+ // MARK: - Public Methods
+ func startScanDevice() {
+ print("扫描中...")
+ devices = []
+
+ centralManager.scanForPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+ let list = centralManager.retrieveConnectedPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)])
+ for item in list {
+ devices.append(item)
+ break
+ }
+ if list.count > 0 {
+ print("缓存",list)
+ }
+ discoverDeviceCallback?(devices)
+ }
+
+ func stopScanDevice() {
+ centralManager.stopScan()
+ }
+
+ func connectPeripheral(_ peripheral: CBPeripheral) {
+ print("连接中...")
+// YLprogressHUD.showLoading()
+ centralManager.connect(peripheral, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
+ SVProgressHUD.show(withStatus: "连接中")
+ // DispatchQueue.main.asyncAfter(deadline: .now() + 15){[weak self] in
+ // self?.cancel()
+ // }
+ }
+
+ func cancel() {
+ guard let peripheral = connectPeripheral else { return }
+ centralManager.cancelPeripheralConnection(peripheral)
+ }
+}
+
+
+extension BleManager : JoyGemAIManagerDelegate {
+ func joyGemAuthFailedCallback() {
+ YLprogressHUD.showAutoHiden("鉴权失败")
+ }
+
+ func joyGemAuthSuccessCallback() {
+ YLprogressHUD.showAutoHiden(text: "鉴权成功"){
+ App.shared.enter()
+ }
+
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+
+ func joyGemAction(_ action: JoyGemActionMode) {
+ switch action {
+ case .cancel:
+ SVProgressHUD.showInfo(withStatus: "请求关闭录音功能/通知关闭了对话")
+ case .recordLive:
+ SVProgressHUD.showInfo(withStatus: "请求开启现场录音")
+ case .recordCall:
+ SVProgressHUD.showInfo(withStatus: "请求开启通话录音")
+ case .si:
+ SVProgressHUD.showInfo(withStatus: "请求开启同声传译")
+ case .chat:
+ SVProgressHUD.showInfo(withStatus: "通知开启了AI对话")
+ @unknown default:
+ break
+ }
+ }
+}
+extension BleManager : JoyGemAIManagerDataSource {
+ func joyGemSend(_ data: Data, with characteristic: CBCharacteristic) {
+ if let connectPeripheral = connectPeripheral{
+ connectPeripheral.writeValue(data, for: characteristic, type:.withoutResponse)
+ }
+ }
+}
+++ /dev/null
-//
-// BlueToothManager.swift
-// BlueToothDemo
-//
-// Created by lianzi on 2022/10/9.
-//
-
-import CoreBluetooth
-
-class BlueToothManager:NSObject{
- /// 状态改变
- var didUpdateStateBlock:((_ central: CBCentralManager) ->Void)?
-
- /// 扫描到设备
- var discoverDeviceBlock:((CBPeripheral,[String : Any],NSNumber) ->Void)?
- /// 连接设备成功
- var didConnectBlock:((CBPeripheral) ->Void)?
- /// 连接设备失败
- var FailConnectBlock:((CBPeripheral) ->Void)?
- /// 设备断开连接
- var disConnectBlock:((CBPeripheral) ->Void)?
-
- /// 发现服务
- var discoverServiceBlock:(([CBService]) ->Void)?
- /// 发现特征
- var discoverPeripheralBlock:(([CBCharacteristic]) ->Void)?
-
- /// 读取到数据
- var receiveDataBlock:((CBPeripheral,CBCharacteristic) ->Void)?
- /// 写入数据(发送指令)成功
- var didWriteDataBlock:((CBPeripheral,CBCharacteristic,Error?) ->Void)?
- /// 读取信息成功
- var didReadRSSIBlock:((CBPeripheral,NSNumber) ->Void)?
-
-
- /// 中央管理类,管理蓝牙的扫描连接
- lazy var centralManager :CBCentralManager = {
- let manager = CBCentralManager(delegate: self, queue: nil)
- return manager
- }()
-
- override init() {
- super.init()
- _ = centralManager.isScanning
- }
-
- /// 开始扫描
- func startScan(){
- // withServices nil代表可以扫描任何的设备
- //CBCentralManagerScanOptionAllowDuplicatesKey是允许重复扫描到
- centralManager.scanForPeripherals(withServices: nil, options: [CBCentralManagerScanOptionAllowDuplicatesKey:true])
- }
-
- /// 停止扫描
- func stopScan(){
- centralManager.stopScan()
- }
-
- /// 连接外设
- /// - Parameter peripheral: 外设
- func connect(peripheral:CBPeripheral){
- centralManager.connect(peripheral)
- }
-
- /// 取消连接外设
- /// - Parameter peripheral: 外设
- func cancelConnect(peripheral:CBPeripheral){
- centralManager.cancelPeripheralConnection(peripheral)
- }
-
- /// 发送数据
- /// - Parameters:
- /// - peripheral: 外设
- /// - characteristic: 特征
- /// - data: 数据
- func sendTo(peripheral:CBPeripheral, characteristic:CBCharacteristic, data:Data){
- peripheral.writeValue(data, for: characteristic, type: .withoutResponse)
- }
-}
-
-extension BlueToothManager:CBCentralManagerDelegate{
- /// 手机蓝牙状态更新
- /// - Parameter central: 中央管理类
- func centralManagerDidUpdateState(_ central: CBCentralManager) {
- didUpdateStateBlock?(central)
- switch central.state{
- case .unknown:
- print("unknown")
- case .resetting:
- print("resetting")
- case .unsupported:
- print("unsupported")
- case .unauthorized:
- print("unauthorized")
- case .poweredOff:
- print("poweredOff")
- case .poweredOn:
- print("poweredOn")
- startScan()
- @unknown default:
- break
- }
- }
- /// 发现设备
- func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
- discoverDeviceBlock?(peripheral,advertisementData,RSSI)
- }
-
- /// 连接上设备
- func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
- peripheral.delegate = self
- peripheral.discoverServices(nil)
- didConnectBlock?(peripheral)
- }
- /// 连接失败
- func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
- FailConnectBlock?(peripheral)
- }
- /// 断开连接
- func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
- disConnectBlock?(peripheral)
- }
-}
-
-extension BlueToothManager:CBPeripheralDelegate{
- /// 读取到信号
- func peripheral(_ peripheral: CBPeripheral, didReadRSSI RSSI: NSNumber, error: Error?) {
- didReadRSSIBlock?(peripheral,RSSI)
- }
- /// 发现服务
- func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
- if error == nil,let list = peripheral.services {
- for s in list {
- peripheral.discoverCharacteristics(nil, for: s)
- }
- discoverServiceBlock?(list)
- }
- else{
- peripheral.discoverServices(nil)
- }
- }
- /// 发现服务找那个的特征,然后遍历所有特征订阅
- func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
- if error == nil,let list = service.characteristics {
-// for s in list {
-// peripheral.setNotifyValue(true, for: s)
-// }
- discoverPeripheralBlock?(list)
- }
- }
- /// 特征状态发生变化通知
- func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: Error?) {
- //读取特征的值
- peripheral.readValue(for: characteristic)
- }
- /// 特征发生变化
- func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
- receiveDataBlock?(peripheral,characteristic)
- }
- /// 写入完成(发送指令完成)
- func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: Error?) {
- didWriteDataBlock?(peripheral,characteristic,error)
- }
-}
+++ /dev/null
-//
-// BlueToothViewModel.swift
-// BlueToothDemo
-//
-// Created by lianzi on 2022/10/9.
-//
-
-import CoreBluetooth
-import UIKit
-
-class BlueToothViewModel:NSObject{
- static let shareModel = BlueToothViewModel()
-
- let bluetooth = BlueToothManager()//蓝牙管理类
- var deviceList = [ScanModel]()//设备列表
-
- var selectedPeripheral:CBPeripheral?//连接上的设备
- var readCha:CBCharacteristic?//读特征
- var writeCha:CBCharacteristic?//写特征
-
-
- var deviceListDidChange:(()->Void)?//扫描列表设备改变
-
- override init() {
- super.init()
- setupBluetooth()
- setupData()
- }
-
-}
-
-extension BlueToothViewModel{
-
- func setupData(){
- }
- func reset(){
- deviceList = [ScanModel]()//设备列表
- selectedPeripheral = nil
- }
-}
-
-extension BlueToothViewModel{
- func setupBluetooth(){
- //状态改变
- bluetooth.didUpdateStateBlock = {[weak self](centrl) in
- self?.didUpdateStats(centrl.state)
- }
- // 扫描到设备
- bluetooth.discoverDeviceBlock = discoverDevice(peripheral:data:rssi:)
- // 连接设备成功
- bluetooth.didConnectBlock = {[weak self] (device) in
- Logger.debug("已连接")
- self?.selectedPeripheral = device
-// self?.didConnect?(device)
-
- }
- // 连接设备失败
- bluetooth.FailConnectBlock = { (device) in
- Logger.debug("连接失败")
- }
- // 设备断开连接
- bluetooth.disConnectBlock = {[weak self](device) in
- Logger.debug("断开连接")
-// SVProgressHUD.showAutoHiden("disconnect")
-// self?.retryConnect()
- }
- // 发现服务
- bluetooth.discoverServiceBlock = { (services) in
- Logger.debug("发现服务 \(services)")
- }
- // 发现特征
- bluetooth.discoverPeripheralBlock = {[weak self] (characteristics) in
- guard let self = self else {return}
- Logger.debug("发现特征 \(characteristics)")
- for cha in characteristics{
- if cha.uuid.uuidString == "FED7" {
- self.writeCha = cha
- self.sendGetDetail()
- }
- if cha.uuid.uuidString == "FED8" {
- self.readCha = cha
- self.selectedPeripheral?.setNotifyValue(true, for: cha)
- }
- }
- }
- // 读取到数据
- bluetooth.receiveDataBlock = {[weak self] (peripheral,characteristic) in
-// print("接收到数据",characteristic)
-// print(characteristic.uuid.uuidString," === ",characteristic.value ?? "")
- if let data = characteristic.value{
- self?.receiveData(data)
- }
- }
- // 写入数据(发送指令)成功
- bluetooth.didWriteDataBlock = { (peripheral,characteristic,error) in
- Logger.debug("发送指令,错误 = \(error)");
- }
- }
- func discoverDevice(peripheral:CBPeripheral, data:[String : Any],rssi: NSNumber){
- guard let name = peripheral.name else{
- return
- }
- if name.isEmpty {
- return
- }
-// if !name.hasPrefix("BlueNRG") {
-// return
-// }
-
- var isContain = false
- for device in deviceList{
- if device.peripheral.identifier.uuidString == peripheral.identifier.uuidString {
-// print("peripheral 的uuid===",device.peripheral.identifier.uuidString)
- isContain = true
- break
- }
- }
- if !isContain{
- let model = ScanModel()
- model.peripheral = peripheral
- model.rssi = rssi
- deviceList.append(model)
- deviceListDidChange?()
- print(name,data)
- }
- }
- func didUpdateStats(_ states:CBManagerState){
- switch states{
- case .poweredOn:
- Logger.debug("poweredOn")
- @unknown default:
- break
- }
- }
-}
-
-extension BlueToothViewModel{
- func sendGetDetail(){
- let data = SendManager.getDetail()
- sendToDevice(data)
- }
- func sendStopDetail(){
- let data = SendManager.getDetail()
- sendToDevice(data)
- }
-
- func sendToDevice(_ data:Data){
- Logger.debug("[send] = \(data.hexEncodedString())")
- guard let p = selectedPeripheral,let c = writeCha else{
- Logger.debug("请先连接设备!!! ")
- return
- }
- bluetooth.sendTo(peripheral:p , characteristic: c, data: data)
- }
-}
-
-extension BlueToothViewModel{
- func receiveData(_ data:Data){
- Logger.debug("[recevice] = \(data.hexEncodedString())")
-
- }
-
-}
-
-
-
+++ /dev/null
-//
-// ReceiveManager.swift
-// Magpie
-//
-// Created by incar on 2024/1/3.
-//
-
-import Foundation
+++ /dev/null
-//
-// ScanModel.swift
-// Magpie
-//
-// Created by incar on 2024/1/3.
-//
-
-import Foundation
-import CoreBluetooth
-/// 扫描的model
-class ScanModel{
- var peripheral:CBPeripheral!
- var rssi:NSNumber!
-}
+++ /dev/null
-//
-// SendManager.swift
-// Magpie
-//
-// Created by incar on 2024/1/3.
-//
-
-import Foundation
-class SendManager {
- static func getDetail() ->Data{
- var bytes = [UInt8](repeating: 0x00, count: 8)
- bytes[0] = 0xFD
- bytes[1] = 0x35
- bytes[2] = 0x09
- bytes[3] = 0x00
- bytes[4] = 0x00
- bytes[5] = 0x00
- bytes[6] = 0x00
- bytes[7] = 0x00
- let data = SendManager.byteToData(arr: bytes)
- return data
- }
- static func stopDetail() ->Data{
- var bytes = [UInt8](repeating: 0x00, count: 4)
- bytes[0] = 0xFD
- bytes[1] = 0x36
- bytes[2] = 0x05
- bytes[3] = 0x00
- let data = SendManager.byteToData(arr: bytes)
- return data
- }
-}
-
-extension SendManager{
- public static func byteToData(arr:[UInt8]) -> Data{
- let bytes = SendManager.appendXmodem(arr: arr)
- let data = Data(bytes: bytes, count: bytes.count)
- return data
- }
-
- public static func appendXmodem(arr:[UInt8]) -> [UInt8]{
- var crc = CRC16.xmodem(arr: arr)
- var list:[UInt8] = [UInt8](repeating: 0x00, count: arr.count + 2)
- for i in 0..<arr.count{
- list[i] = arr[i]
- }
-
- let crcData: Data = Data(bytes: &crc, count: 2)
- let crcBytes = [UInt8](crcData)
- list[arr.count] = crcBytes[1]
- list[arr.count + 1] = crcBytes[0]
-
- return list
- }
-}
-class CRC16{
- public static func xmodem(arr: [UInt8]) -> Int {
- var wCRCin = 0x0000;
- let wCPoly = 0x1021;
- let len = arr.count;
- for i in 0...len-1 {
- for j in 0...7 {
- let bit = ((arr[i] >> (7 - j) & 1) == 1);
- let c15 = ((wCRCin >> 15 & 1) == 1);
- wCRCin <<= 1;
- if(c15 != bit) {
- wCRCin ^= wCPoly;
- }
- }
- }
- wCRCin &= 0xFFFF;
- wCRCin ^= 0x0000;
- return wCRCin
- }
-}
</array>
</dict>
</dict>
- <key>NSPhotoLibraryUsageDescription</key>
- <string>修改用户头像、提交意见反馈需要访问相册</string>
- <key>NSCameraUsageDescription</key>
- <string>修改用户头像、提交意见反馈需要访问相册使用摄像头</string>
+ <key>UIBackgroundModes</key>
+ <array>
+ <string>bluetooth-peripheral</string>
+ <string>bluetooth-central</string>
+ <string>audio</string>
+ </array>
</dict>
</plist>
--- /dev/null
+//
+// JoySdkManager.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/29.
+//
+import JoyGemAI
+import UIKit
+import SVProgressHUD
+import AVFoundation
+
+class JoySdkManager:NSObject{
+ static let shared = JoySdkManager()
+
+ func setupSdk(){
+ //MARK: 初始化SDK
+ JoyGemAIManager.shared().initSdk()
+ //MARK: 配置日志类型
+ JoyGemAIManager.shared().setLogMode(JoyGemLogMode.all)
+
+
+ let fileManager = FileManager.default
+ if let appSupportDirectory = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first {
+ let logDirectory = appSupportDirectory.appendingPathComponent("log")
+
+ // 检查 log 文件夹是否存在
+ if !fileManager.fileExists(atPath: logDirectory.path) {
+ do {
+ // 创建 log 文件夹
+ try fileManager.createDirectory(at: logDirectory, withIntermediateDirectories: true, attributes: nil)
+ print("log 文件夹已创建: \(logDirectory.path)")
+ } catch {
+ print("创建 log 文件夹时出错: \(error.localizedDescription)")
+ }
+ } else {
+ print("log 文件夹已存在: \(logDirectory.path)")
+ }
+
+ // 获取当前日期并格式化
+ let currentDate = Date()
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateFormat = "yyyyMMddHHmmss"
+ let dateString = dateFormatter.string(from: currentDate)
+
+ // 创建日志文件名和路径
+ let fileName = "SDK_\(dateString).log"
+ let filePath = logDirectory.appendingPathComponent(fileName)
+
+ // 创建空文件
+ if !fileManager.fileExists(atPath: filePath.path) {
+ // 创建空文件
+ fileManager.createFile(atPath: filePath.path, contents: nil, attributes: nil)
+ print("日志文件已创建: \(filePath.path)")
+ } else {
+ print("日志文件已存在: \(filePath.path)")
+ }
+
+ //MARK: 配置日志路径
+ JoyGemAIManager.shared().setLogPath(filePath.path)
+ } else {
+ print("无法找到应用支持目录")
+ }
+
+ //MARK: 配置缓存路径
+ let tempPath = NSTemporaryDirectory();
+ JoyGemAIManager.shared().setCacheDirectory(tempPath)
+ JoyGemAIManager.shared().setTWSAutoSync(true)
+ }
+}
+
//
import UIKit
-import IQKeyboardManagerSwift
+
class SceneDelegate: UIResponder, UIWindowSceneDelegate {
var window: UIWindow?
guard let _ = (scene as? UIWindowScene) else { return }
App.shared.window = window
- setConfig()
window?.rootViewController = BaseTC()
- window?.rootViewController = UINavigationController(rootViewController: ChatVC())
-
+ window?.rootViewController = UINavigationController(rootViewController: FieldRecordingVC())
+ AppLaunch.start()
}
func sceneDidDisconnect(_ scene: UIScene) {
// to restore the scene back to its current state.
}
- func setConfig(){
- if #available(iOS 15.0, *) {
- UITableView.appearance().sectionHeaderTopPadding = 0
- }
- IQKeyboardManager.shared.enableAutoToolbar = true
- IQKeyboardManager.shared.isEnabled = true
- IQKeyboardManager.shared.resignOnTouchOutside = true
- }
+
}
//#import "SVProgressHUD+YLAdd.h"
#import "YLTimerButton.h"
+#import "PcmSound.h"
+
--- /dev/null
+
+
+#import <Foundation/Foundation.h>
+
+#define NAMESPACE @"pcm_sound"
+
+@protocol PcmSoundDelegate <NSObject>
+
+-(void)remaining:(NSUInteger)frames;
+
+@end
+
+@interface PcmSound : NSObject
+
++ (PcmSound*)sharedInstance;
+
+@property(nonatomic,weak) id<PcmSoundDelegate> delegate;
+
+-(BOOL)isPlaying;
+
+-(void)setLogLevel:(NSNumber*)logLevelNumber;
+
+-(void)setup:(int)sampleRate withchannels:(int)numChannels;
+
+-(void)feed:(NSData*)buffer;
+
+-(void)setFeedThreshold:(NSNumber*)feedThreshold;
+
+-(void)stopAudioUnit;
+
+- (void)cleanup;
+
+@end
--- /dev/null
+#import "PcmSound.h"
+#import <AudioToolbox/AudioToolbox.h>
+
+#if TARGET_OS_IOS
+#import <AVFoundation/AVFoundation.h>
+#endif
+
+#define kOutputBus 0
+#define NAMESPACE @"pcm_sound" // Assuming this is the namespace you want
+
+typedef NS_ENUM(NSUInteger, LogLevel) {
+ none = 0,
+ error = 1,
+ standard = 2,
+ verbose = 3,
+};
+
+@interface PcmSound ()
+@property(nonatomic) LogLevel mLogLevel;
+@property(nonatomic) AudioComponentInstance mAudioUnit;
+@property(nonatomic) NSMutableData *mSamples;
+@property(nonatomic) int mNumChannels;
+@property(nonatomic) int mFeedThreshold;
+@property(nonatomic) bool mDidInvokeFeedCallback;
+@end
+
+@implementation PcmSound
+
++ (instancetype)sharedInstance {
+ static PcmSound *sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [[self alloc] init];
+ sharedInstance.mLogLevel = verbose;
+ sharedInstance.mSamples = [NSMutableData new];
+ sharedInstance.mFeedThreshold = 0;
+ sharedInstance.mDidInvokeFeedCallback = false;
+ });
+ return sharedInstance;
+}
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+
+ }
+ return self;
+}
+
+-(void)dealloc {
+
+}
+
+-(void)setLogLevel:(NSNumber*)logLevelNumber {
+ self.mLogLevel = (LogLevel)[logLevelNumber integerValue];
+}
+
+-(void)setup:(int)sampleRate withchannels:(int)numChannels {
+
+ self.mNumChannels = numChannels;
+
+ // cleanup
+ if (_mAudioUnit != nil) {
+ [self cleanup];
+ }
+
+ // create
+ AudioComponentDescription desc;
+ desc.componentType = kAudioUnitType_Output;
+#if TARGET_OS_IOS
+ desc.componentSubType = kAudioUnitSubType_RemoteIO;
+#else // MacOS
+ desc.componentSubType = kAudioUnitSubType_DefaultOutput;
+#endif
+ desc.componentFlags = 0;
+ desc.componentFlagsMask = 0;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+ AudioComponent inputComponent = AudioComponentFindNext(NULL, &desc);
+ OSStatus status = AudioComponentInstanceNew(inputComponent, &_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioComponentInstanceNew failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // set stream format
+ AudioStreamBasicDescription audioFormat;
+ audioFormat.mSampleRate = sampleRate;
+ audioFormat.mFormatID = kAudioFormatLinearPCM;
+ audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
+ audioFormat.mFramesPerPacket = 1;
+ audioFormat.mChannelsPerFrame = self.mNumChannels;
+ audioFormat.mBitsPerChannel = 16;
+ audioFormat.mBytesPerFrame = self.mNumChannels * (audioFormat.mBitsPerChannel / 8);
+ audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
+
+ status = AudioUnitSetProperty(_mAudioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ kOutputBus,
+ &audioFormat,
+ sizeof(audioFormat));
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitSetProperty StreamFormat failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // set callback
+ AURenderCallbackStruct callback;
+ callback.inputProc = RenderCallback;
+ callback.inputProcRefCon = (__bridge void *)(self);
+
+ status = AudioUnitSetProperty(_mAudioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ kAudioUnitScope_Global,
+ kOutputBus,
+ &callback,
+ sizeof(callback));
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitSetProperty SetRenderCallback failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // initialize
+ status = AudioUnitInitialize(_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitInitialize failed. OSStatus: %@", @(status)];
+ return;
+ }
+}
+
+-(void)feed:(NSData*)buffer {
+
+ @synchronized (self.mSamples) {
+ [self.mSamples appendData:buffer];
+ }
+
+ // reset
+ self.mDidInvokeFeedCallback = false;
+
+ // start playback if we can
+ if (_mAudioUnit != nil) {
+ UInt32 isPlaying = 0;
+ UInt32 size = sizeof(isPlaying);
+ OSStatus status = AudioUnitGetProperty(_mAudioUnit,
+ kAudioOutputUnitProperty_IsRunning,
+ kAudioUnitScope_Global,
+ 0,
+ &isPlaying,
+ &size);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitGetProperty IsRunning failed. OSStatus: %@", @(status)];
+ return;
+ }
+ if (!isPlaying) {
+ status = AudioOutputUnitStart(_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioOutputUnitStart failed. OSStatus: %@", @(status)];
+ return;
+ }
+ }
+ }
+}
+
+-(void)setFeedThreshold:(NSNumber*)feedThreshold {
+ self.mFeedThreshold = [feedThreshold intValue];
+}
+
+-(BOOL)isPlaying {
+ return self.mSamples.length > 0;
+}
+
+
+- (void)cleanup
+{
+ if (_mAudioUnit != nil) {
+ AudioUnitUninitialize(_mAudioUnit);
+ AudioComponentInstanceDispose(_mAudioUnit);
+ _mAudioUnit = nil;
+ }
+ @synchronized (self.mSamples) {
+ self.mSamples = [NSMutableData new];
+ }
+}
+
+- (void)stopAudioUnit
+{
+ if (_mAudioUnit != nil) {
+ UInt32 isRunning = 0;
+ UInt32 size = sizeof(isRunning);
+ OSStatus status = AudioUnitGetProperty(_mAudioUnit,
+ kAudioOutputUnitProperty_IsRunning,
+ kAudioUnitScope_Global,
+ 0,
+ &isRunning,
+ &size);
+ if (status != noErr) {
+ NSLog(@"AudioUnitGetProperty IsRunning failed. OSStatus: %@", @(status));
+ return;
+ }
+ if (isRunning) {
+ status = AudioOutputUnitStop(_mAudioUnit);
+ if (status != noErr) {
+ NSLog(@"AudioOutputUnitStop failed. OSStatus: %@", @(status));
+ } else {
+ NSLog(@"AudioUnit stopped because no more samples");
+ }
+ }
+ }
+}
+
+
+static OSStatus RenderCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ PcmSound *instance = (__bridge PcmSound *)(inRefCon);
+
+ NSUInteger remainingFrames;
+ BOOL shouldRequestMore = false;
+
+ @synchronized (instance.mSamples) {
+
+ // clear
+ memset(ioData->mBuffers[0].mData, 0, ioData->mBuffers[0].mDataByteSize);
+
+ NSUInteger bytesToCopy = MIN(ioData->mBuffers[0].mDataByteSize, [instance.mSamples length]);
+
+ // provide samples
+ memcpy(ioData->mBuffers[0].mData, [instance.mSamples bytes], bytesToCopy);
+
+ // pop front bytes
+ NSRange range = NSMakeRange(0, bytesToCopy);
+ [instance.mSamples replaceBytesInRange:range withBytes:NULL length:0];
+
+ remainingFrames = [instance.mSamples length] / (instance.mNumChannels * sizeof(short));
+
+ // should request more frames?
+ shouldRequestMore = remainingFrames <= instance.mFeedThreshold && !instance.mDidInvokeFeedCallback;
+ }
+
+ // stop running, if needed
+ if (remainingFrames == 0) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [instance stopAudioUnit];
+ });
+ }
+
+ if (shouldRequestMore) {
+ instance.mDidInvokeFeedCallback = true;
+ //NSDictionary *response = @{@"remaining_frames": @(remainingFrames)};
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if ([instance.delegate respondsToSelector:@selector(remaining:)]) {
+ [instance.delegate remaining:remainingFrames];
+ }
+ });
+ }
+
+ return noErr;
+}
+
+
+@end
class App{
static let shared = App()
var window:UIWindow?
+
+
func topVC()->UIViewController!{
guard let vc = window?.rootViewController else{
print("页面异常!!!")
return getTopViewController(from: vc)
}
+ func enter(){
+ window?.rootViewController = BaseTC()
+ }
+
func goToPage(_ viewController: UIViewController,animated:Bool = true){
viewController.hidesBottomBarWhenPushed = true
topVC().navigationController?.pushViewController(viewController, animated: animated)
}
return views
}
+// func setupRightViews(_ views:[UIView]){
+// var x = 0
+// for item in views {
+// let w = item.bounds.size.width
+// addSubview(item)
+// item.snp.makeConstraints { (m) in
+// m.top.equalTo(kNavTop)
+// m.bottom.equalToSuperview()
+// m.width.greaterThanOrEqualTo(w)
+// m.right.equalToSuperview().inset(x)
+// }
+//
+// x = x + w
+// }
+// }
}
// private(set) var _currentDate = Date()
- var datePicker = UIPickerView(frame: CGRect(x: 0, y:0, width: kScreenWid, height: 300.fitR))
+ var datePicker = UIPickerView(frame: CGRect(x: 0, y:0, width: kScreenWid, height: 300))
private let titleLabel = UILabel()
private let des = UILabel()
private let okButton = UIButton()
init() {
- super.init(contentHeight: 300.fitR)
+ super.init(contentHeight: 300)
}
required init?(coder: NSCoder) {
}
public func pickerView(_ pickerView: UIPickerView, rowHeightForComponent component: Int) -> CGFloat {
- return 43.fitR
+ return 43
}
public func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
}
}
}
+
+class BasePresentView2: UIView {
+ let bgView = UIView()
+ init(backgroundEnabled:Bool = true) {
+ super.init(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: kScreenHei))
+ setupSubView()
+ setupLayout()
+ setupStyle()
+ if backgroundEnabled {
+ bgView.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(hide)))
+ }
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+ func setupSubView(){
+ addSubview(bgView)
+ }
+
+ func setupLayout(){
+ bgView.snp.makeConstraints { (make) in
+ make.edges.equalToSuperview()
+ }
+
+ }
+ func setupStyle(){
+ backgroundColor = UIColor.clear
+ bgView.backgroundColor = UIColor.init(white: 0, alpha: 0.5)
+
+
+ }
+ func show(animate:Bool = true) -> Void {
+ App.shared.window?.addSubview(self)
+
+ }
+
+ @objc func hide() -> Void {
+ UIView.animate(withDuration: 0.2, animations: {
+ self.layer.opacity = 0.0
+ }) { (finished) in
+ self.removeFromSuperview()
+ }
+ }
+}
}
setupViews()
setupLayout()
- loadData()
+ setupData()
addLog()
}
open override func viewWillAppear(_ animated: Bool) {
func setupLayout(){
}
- func loadData(){
+ func setupData(){
}
+
func addLog(){
logBtn.frame = CGRect(x: UIScreen.main.bounds.size.width - 80, y: 200, width:60, height: 60)
logBtn.backgroundColor = .blue
class GlobalConfig{
static let languages = ["简体中文","English","日语","法语"]
+ static let tranlateLanguages = [
+ "中文",
+ "英文",
+ "日文",
+ "韩文",
+ "法文",
+ "西班牙文",
+ "葡萄牙文",
+ "印度尼西亚",
+ "俄文",
+ "马来文",
+ ]
}
SVProgressHUD.setMinimumDismissTimeInterval(1.5)
SVProgressHUD.setDefaultStyle(.dark)
SVProgressHUD.setDefaultMaskType(.clear)
- SVProgressHUD.setContainerView(UIApplication.shared.keyWindow)
+ SVProgressHUD.setContainerView(App.shared.window)
SVProgressHUD.show(UIImage(), status: text)
}
/// 获取当前顶层视图控制器
static func topViewController() -> UIViewController? {
- guard let rootVC = UIApplication.shared.keyWindow?.rootViewController else {
+ guard let rootVC = App.shared.window!.rootViewController else {
return nil
}
return getTopViewController(from: rootVC)
+++ /dev/null
-//
-// DeviceVC.swift
-// Magpie
-//
-// Created by incar on 2024/1/10.
-//
-
-import Foundation
-import UIKit
-
-class DeviceVC:BaseVC{
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.navBar.title = "设备"
-
- }
-}
+++ /dev/null
-//
-// DeviceVC.swift
-// Magpie
-//
-// Created by incar on 2024/1/10.
-//
-
-import Foundation
-import UIKit
-
-class DiscoverVC:BaseVC{
-
- override func viewDidLoad() {
- super.viewDidLoad()
- self.navBar.title = "发现"
-
- }
-}
/// Ai回应模型
public class ChatCellModel {
public var type: Int = 0
-
public var content: String = ""
-
- public var description: String {
- return "UBAiResponse(type: \(type), state:\(type), content:\(content))"
- }
+ public var id:UInt = 0
}
class ChatCell:BaseTableViewCell{
var data:ChatCellModel!{
didSet{
+ if data.content.isEmpty{
+ data.content = "..."
+ }
if data.type == 1 {
bgView.backgroundColor = .color(.theme)
originalLabel.textColor = .white
--- /dev/null
+//
+// ChatHeaderView.swift
+// ShenYin
+//
+// Created by liangshi on 2025/9/3.
+//
+
+class ChatHeaderView: BaseView {
+ let icon = UIImageView()
+ let titleLabel = UILabel()
+ let desLabel = UILabel()
+
+
+ override func setupViews() {
+// backgroundColor = .red
+ addSubviews([icon,titleLabel,desLabel])
+
+ icon.do { v in
+ v.yc.setCornerRadius(70)
+ v.image = UIImage(named: "chat_xiaoyin")
+ }
+ titleLabel.do {v in
+ v.text = "嗨!我是小音"
+ v.numberOfLines = 0
+ v.textAlignment = .center
+ v.textColor = .hexString("#121212")
+ v.font = .bold(18)
+ }
+ desLabel.do {v in
+ v.text = "我可以帮你搜索、答疑、写作,请把你的任务交给 我吧~"
+ v.numberOfLines = 0
+ v.textAlignment = .center
+ v.textColor = .hexString("#666666")
+ v.font = .bold(14)
+ }
+ }
+
+ override func setupLayout() {
+ icon.snp.makeConstraints { make in
+ make.size.equalTo(140)
+ make.centerX.equalToSuperview()
+ make.top.equalToSuperview().inset(20)
+ }
+ titleLabel.snp.makeConstraints { make in
+ make.left.right.equalToSuperview().inset(33)
+ make.top.equalTo(icon.snp.bottom).offset(20)
+ }
+ desLabel.snp.makeConstraints { make in
+ make.left.right.equalToSuperview().inset(33)
+ make.top.equalTo(titleLabel.snp.bottom).offset(10)
+ }
+ }
+}
--- /dev/null
+//
+// RecordBar.swift
+// ShenYin
+//
+// Created by liangshi on 2025/9/3.
+//
+
+@objc protocol ChatRecordBarDelegate {
+ func recordBarStart(_ toolBar:ChatRecordBar)
+ func recordBarStop(_ toolBar:ChatRecordBar)
+}
+
+class ChatRecordBar:BaseView{
+ var recordBtn = UIButton(type: .custom)
+ weak var delegate:ChatRecordBarDelegate?
+
+ override func setupViews() {
+ recordBtn.backgroundColor = .blue
+ recordBtn.setTitle("开始录音", for: .normal)
+ recordBtn.setTitle("停止录音", for: .selected)
+ recordBtn.addTarget(self, action: #selector(recordAction), for: .touchUpInside)
+ addSubview(recordBtn)
+
+ }
+ override func setupLayout() {
+ recordBtn.snp.makeConstraints { make in
+ make.width.centerX.bottom.equalToSuperview()
+ make.height.equalToSuperview()
+ }
+ }
+
+ @objc func recordAction(){
+ recordBtn.isSelected = !recordBtn.isSelected
+ if recordBtn.isSelected{
+ delegate?.recordBarStart(self)
+ }
+ else{
+ delegate?.recordBarStop(self)
+ }
+ }
+}
+
//
import UIKit
-
+import JoyGemAI
+import AVFAudio
class ChatVC:BaseVC{
- let toolBar = SendToolBar()
+ let rightItem = NavigationBarItem(frame: CGRect(x: 0, y: 0, width: 80, height: 44))
+ let roleItem = ChatRoleItem(frame: CGRect(x: 0, y: 0, width: 100, height: 44))
+
+ let toolBar = ChatRecordBar()
let tableView = UITableView(frame: CGRectZero, style: .plain)
+ let headerView = ChatHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: 260))
var dataList:[ChatCellModel] = []
+ var roleList:[JoyGemSpeaker] = []
+ var isTtsPlaying = false
+
+ deinit {
+ JoyGemChatManager.shared().removeObserver(self, forKeyPath: "isActive")
+ }
+
override func viewDidLoad() {
super.viewDidLoad()
}
override func setupViews() {
- navBar.rightView.setImage(UIImage(named: "help_icon"), for: .normal)
+ navBar.rightView.isHidden = true
+ navBar.addSubviews([roleItem,rightItem])
+ roleItem.yc.addTap(target: self, action: #selector(roleBtnAction))
+ rightItem.yc.addTap(target: self, action: #selector(rightBtnAction))
tableView.backgroundColor = .clear
tableView.delegate = self
tableView.estimatedRowHeight = 60
tableView.separatorStyle = .none
tableView.register(ChatCell.self, forCellReuseIdentifier: ChatCell.reuseID)
- view.addSubview(tableView)
-
+ tableView.tableHeaderView = headerView
- toolBar.textField.text = ""
- toolBar.delegate = self
+ view.addSubview(tableView)
view.addSubview(toolBar)
-
+ toolBar.delegate = self
}
override func setupLayout() {
+ rightItem.snp.makeConstraints { (m) in
+ m.top.equalTo(kNavTop)
+ m.bottom.equalToSuperview()
+ m.width.greaterThanOrEqualTo(80)
+ m.right.equalToSuperview()
+ }
+ roleItem.snp.makeConstraints { (m) in
+ m.top.equalTo(kNavTop)
+ m.bottom.equalToSuperview()
+ m.width.greaterThanOrEqualTo(80)
+ m.left.equalToSuperview().inset(48)
+ }
toolBar.snp.makeConstraints { make in
make.width.centerX.equalToSuperview()
make.height.equalTo(52)
make.bottom.equalTo(toolBar.snp.top)
}
}
- override func loadData() {
- let model1 = ChatCellModel()
- model1.type = 0
- model1.content = "您好,有什么可以帮助您"
-
- let model2 = ChatCellModel()
- model2.type = 1
- model2.content = "明天会下雨吗"
+ override func setupData() {
+ JoyGemChatManager.shared().getSpeakerList {[weak self] speakers in
+ guard let self = self,speakers.count > 0 else{return}
+ self.roleList = speakers
+ self.roleItem.role = speakers.first
+ JoyGemChatManager.shared().setSpeaker(self.roleItem.role)
+ }
- let model3 = ChatCellModel()
- model3.type = 0
- model3.content = "明天晴转多云,不下雨。明天去哪里玩呀,有没有选好地方,我知道好很多好玩的地方哦"
+ JoyGemChatManager.shared().delegate = self
+ PcmSound.sharedInstance().delegate = self
+ JoyGemChatManager.shared().addObserver(self, forKeyPath: "isActive",options: [.new, .old], context: nil);
+ }
+ override func viewWillDisappear(_ animated: Bool) {
+ super.viewWillDisappear(animated)
- let model4 = ChatCellModel()
- model4.type = 1
- model4.content = "好的,谢谢啊"
- dataList = [model1,model2,model3,model4]
- tableView.reloadData()
+ ///结束对话,但并不会终止正在播放的录音
+ JoyGemChatManager.shared().stopChat()
+ }
+ override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+ if (keyPath == "isActive") {
+ var isOpen = change?[NSKeyValueChangeKey.newKey] as? Bool
+ if (isOpen == true) {
+ YLprogressHUD.showAutoHiden("AI对话开启")
+ } else {
+ YLprogressHUD.showAutoHiden( "AI对话结束")
+ PcmSound.sharedInstance().cleanup()
+ }
+ }
+ }
+
+ @objc func rightBtnAction() {
+ App.shared.goToPage(IntelligentVC())
}
- override func navRightViewTapped() {
- App.shared.goToPage(RoleListVC())
+ @objc func roleBtnAction(){
+ let vc = RoleListVC(list: roleList, selectedModel: roleItem.role) {[weak self] model in
+ guard let self = self else{return}
+ roleItem.role = model
+ JoyGemChatManager.shared().setSpeaker(model)
+ }
+ App.shared.goToPage(vc)
}
func scrollToBottom(){
if dataList.count > 0 {
}
}
}
+
+extension ChatVC:ChatRecordBarDelegate{
+ func recordBarStart(_ toolBar: ChatRecordBar) {
+// JoyGemChatManager.shared().playAudioEnd()
+ JoyGemChatManager.shared().stopChat()
+ JoyGemChatManager.shared().startSingleChat()
+ }
+
+ func recordBarStop(_ toolBar: ChatRecordBar) {
+ JoyGemChatManager.shared().stopSingleChat()
+ }
+}
+
extension ChatVC:UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return dataList.count
}
}
-extension ChatVC:SendToolBarDelegate{
- func sendToolBar(_ toolBar: SendToolBar, _ text: String) {
- toolBar.textField.resignFirstResponder()
- // list.append(ChatCellModel(isSend:true,content:text))
- // tableView.reloadData()
- // scrollToBottom()
- // StartburstGlassesSdk.shared().chat.fireText(text)
+
+extension ChatVC : JoyGemChatManagerDelegate {
+ func chatManager(_ manager: JoyGemChatManager, stateChange code: JoyGemStateCode) {
+ switch code {
+ case .startRecord:
+ if (isTtsPlaying) {
+ isTtsPlaying = false
+ PcmSound.sharedInstance().cleanup()
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+// stateLabel.text = "正在录音"
+ break
+ case .stopRecord:
+// stateLabel.text = "操作耳机"
+ break
+ default:
+ break
+ }
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, onError code: JoyGemErrorCode) {
+
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, audioData data: Data?, finish isFinish: Bool) {
+ if (!isTtsPlaying) {
+ isTtsPlaying = true
+ JoyGemChatManager.shared().playAudioStart()
+ }
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, requestText text: String?, index: UInt) {
+ Logger.debug(text,index)
+ if let text = text {
+ if let model = dataList.last,model.id == index,model.type == 1 {
+ model.content = text
+ }
+ else{
+ let model = ChatCellModel()
+ model.type = 1
+ model.content = text
+ model.id = index
+ dataList.append(model)
+ }
+ tableView.reloadData()
+ scrollToBottom()
+ }
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, responseText text: String?, index: UInt, finish isFinish: Bool) {
+// responseTextView.text = text;
+ Logger.debug(text,index)
+ if let text = text {
+ if let model = dataList.last,model.id == index,model.type == 0 {
+ model.content = text
+ }
+ else{
+ let model = ChatCellModel()
+ model.type = 0
+ model.content = text
+ model.id = index
+ dataList.append(model)
+ }
+ tableView.reloadData()
+ scrollToBottom()
+ }
+
+ }
+
+ func chatManagerStopped(_ manager: JoyGemChatManager) {
+
+ }
+}
+
+extension ChatVC : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ print("[frame:\(frames)]");
+ if (frames == 0) {
+ JoyGemChatManager.shared().playAudioEnd()
+ }
}
}
--- /dev/null
+//
+// IntelligentVC.swift
+// ShenYin
+//
+// Created by liangshi on 2025/9/3.
+//
+
+import UIKit
+class IntelligentVC: BaseVC{
+ var didSelected:(()->Void)?
+ let tableView = UITableView(frame: .zero, style: .plain)
+ var list = [1,2,3]
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ // Do any additional setup after loading the view.
+ }
+ override func setupViews() {
+ self.navBar.title = "智能体"
+ tableView.do { v in
+ v.backgroundColor = .rgb(0xF7F7F7)
+ v.delegate = self
+ v.dataSource = self
+ v.rowHeight = 106
+ v.separatorStyle = .none
+ v.register(IntelligentCell.self, forCellReuseIdentifier: IntelligentCell.reuseID)
+ }
+ view.addSubview(tableView)
+ }
+ override func setupLayout() {
+ tableView.snp.makeConstraints { make in
+ make.left.right.bottom.equalToSuperview()
+ make.top.equalTo(kNavBtm)
+ }
+ }
+}
+
+extension IntelligentVC:UITableViewDelegate,UITableViewDataSource {
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return list.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = IntelligentCell.cell(withTableView: tableView, indexPath: indexPath)
+// cell.type = list[indexPath.row]
+ return cell
+ }
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ let data = list[indexPath.row]
+ didSelected?()
+ navigationController?.popViewController(animated: true)
+ }
+}
+
+
+class IntelligentCell: BaseTableViewCell {
+ let bgView = UIView()
+ let icon = UIImageView()
+ let titleLabel = UILabel()
+ let deslabel = UILabel()
+
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+ override func setupViews() {
+ contentView.addSubview(bgView)
+ bgView.addSubviews([titleLabel,icon,deslabel])
+
+ backgroundColor = .rgb(0xF7F7F7)
+ contentView.backgroundColor = .clear
+ selectionStyle = .none
+ bgView.do { v in
+ v.backgroundColor = UIColor.white
+ v.yc.setCornerRadius(8)
+ }
+ titleLabel.do { (v) in
+ v.textColor = .rgb(0x121212)
+ v.font = .bold(16)
+ v.textAlignment = .left
+ v.text = "英语练习"
+ v.numberOfLines = 0
+ }
+ deslabel.do { (v) in
+ v.textColor = .hexString("#919191")
+ v.font = .regular(14)
+ v.textAlignment = .left
+ v.text = "我擅长英文,我可以陪你一起练习英语哦!"
+ v.numberOfLines = 0
+ }
+ icon.do { v in
+ v.backgroundColor = .lightGray
+ v.yc.setCornerRadius(30)
+ }
+
+ }
+
+ override func setupLayout() {
+ bgView.snp.makeConstraints { (m) in
+ m.left.right.equalToSuperview().inset(18)
+ m.top.bottom.equalToSuperview().inset(5)
+ }
+
+ icon.snp.makeConstraints { (m) in
+ m.size.equalTo(60)
+ m.left.equalToSuperview().inset(18)
+ m.centerY.equalToSuperview()
+ }
+ titleLabel.snp.makeConstraints { (m) in
+ m.top.equalTo(16)
+ m.left.equalTo(icon.snp.right).offset(10)
+ m.right.equalToSuperview().inset(18)
+ }
+ deslabel.snp.makeConstraints { make in
+ make.left.right.equalTo(titleLabel)
+ make.top.equalTo(41)
+ }
+ }
+}
--- /dev/null
+//
+// NavigationBarItem.swift
+// ShenYin
+//
+// Created by liangshi on 2025/9/3.
+//
+import UIKit
+import JoyGemAI
+class NavigationBarItem: BaseView {
+ let icon = UIImageView()
+ let titleLabel = UILabel()
+
+ override func setupViews() {
+// backgroundColor = .red
+ addSubviews([titleLabel,icon])
+ icon.do { v in
+ v.image = UIImage(named: "search")
+ }
+ titleLabel.do { v in
+ v.textColor = .rgb(0x121212)
+ v.font = .bold(14)
+ v.text = "智能体"
+ }
+ }
+
+ override func setupLayout() {
+ icon.snp.makeConstraints { make in
+ make.size.equalTo(18)
+ make.centerY.equalToSuperview()
+ make.left.equalToSuperview()
+ }
+ titleLabel.snp.makeConstraints { make in
+ make.left.equalTo(icon.snp.right).offset(3)
+ make.centerY.equalTo(icon)
+ }
+ }
+}
+
+
+class ChatRoleItem: BaseView {
+ let icon = UIImageView()
+ let titleLabel = UILabel()
+ let deslabel = UILabel()
+ var role:JoyGemSpeaker!{
+ didSet{
+ titleLabel.text = role.name
+ }
+ }
+
+ override func setupViews() {
+ // backgroundColor = .red
+ addSubviews([titleLabel,icon,deslabel])
+ icon.do { v in
+ v.image = UIImage(named: "chat_xiaoyin")
+ v.yc.setCornerRadius(18)
+ }
+ titleLabel.do { v in
+ v.textColor = .rgb(0x121212)
+ v.font = .bold(14)
+ v.text = "智能体"
+ }
+ deslabel.do { v in
+ v.textColor = .rgb(0x9C9C9C)
+ v.font = .regular(10)
+ v.text = "切换角色"
+ }
+ }
+
+ override func setupLayout() {
+ icon.snp.makeConstraints { make in
+ make.size.equalTo(36)
+ make.centerY.equalToSuperview()
+ make.left.equalToSuperview()
+ }
+ titleLabel.snp.makeConstraints { make in
+ make.left.equalTo(icon.snp.right).offset(8)
+ make.top.equalToSuperview().inset(6)
+ }
+ deslabel.snp.makeConstraints { make in
+ make.left.equalTo(titleLabel)
+ make.bottom.equalToSuperview().inset(6)
+ }
+ }
+}
//
import UIKit
+import JoyGemAI
class RoleListVC: BaseVC{
let tableView = UITableView(frame: .zero, style: .plain)
- var list = [1,2,3,4,5,6,7]
+ let list:[JoyGemSpeaker]
+ let selectedModel:JoyGemSpeaker
+ var didSelected:((JoyGemSpeaker)->Void)?
+
+ init(list: [JoyGemSpeaker], selectedModel: JoyGemSpeaker, didSelected: ((JoyGemSpeaker) -> Void)? = nil) {
+ self.list = list
+ self.selectedModel = selectedModel
+ self.didSelected = didSelected
+ super.init()
+ }
override func viewDidLoad() {
super.viewDidLoad()
make.top.equalTo(kNavBtm)
}
}
+ override func setupData() {
+// JoyGemChatManager.shared().getSpeakerList {[weak self] speakers in
+// guard let self = self else{return}
+// self.list = speakers
+// self.tableView.reloadData()
+// }
+ }
}
extension RoleListVC:UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = RoleListCell.cell(withTableView: tableView, indexPath: indexPath)
-// cell.type = list[indexPath.row]
+ cell.data = list[indexPath.row]
+ cell.selectedIcon.isHidden = list[indexPath.row] !== selectedModel
let rect = CGRect(x: 0, y: 0, width: kScreenWid - 36, height: 52)
if indexPath.row == 0 {
cell.bgView.yc.setCorners(withRoundedRect: rect, roundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 8, height: 8))
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let data = list[indexPath.row]
+ didSelected?(data)
+ navigationController?.popViewController(animated: true)
}
}
let titleLabel = UILabel()
let selectedIcon = UIImageView()
let line = UIView()
+ var data:JoyGemSpeaker!{
+ didSet{
+ titleLabel.text = data.name
+ }
+ }
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
v.textColor = .rgb(0x121212)
v.font = .bold(14)
v.textAlignment = .left
- v.text = "阳光大男孩"
}
icon.do { v in
v.backgroundColor = .lightGray
//
enum RecordSate:Int{
- case normal
- case recording
+ case start
+ case stop
+ case resume
case pause
}
+protocol FieldRecordBarDelegate {
+ func fieldRecordBar(_ bar:FieldRecordBar,languageChange language:String)
+ func fieldRecordBar(_ bar:FieldRecordBar,stateChange state:RecordSate)
+}
+
+
class FieldRecordBar: BaseView {
let recordBtn = UIButton()
let leftItem = RecordBarItem()
let rightItem = RecordBarButton()
- var state:RecordSate = .normal
+ var state:RecordSate = .stop
+
+// var languageDidChange:((String)->Void)?
+// var recordStateDidChange:((RecordSate)->Void)?
+ var delegate:FieldRecordBarDelegate?
override func setupViews() {
backgroundColor = .white
v.yc.addTap(target: self, action: #selector(leftAction))
}
rightItem.do {v in
- v.state = .normal
+ v.state = .stop
v.yc.addTap(target: self, action: #selector(pauseAction))
}
}
v.didSelected = {[weak self] (index,value) in
guard let self = self else { return }
leftItem.titleLabel.text = value
+ delegate?.fieldRecordBar(self, languageChange:value)
}
return
}
@objc func recordBtnAction(){
recordBtn.isSelected = !recordBtn.isSelected
- rightItem.state = .recording
+ rightItem.state = .start
rightItem.isHidden = !recordBtn.isSelected
if recordBtn.isSelected {
else{
leftItem.alpha = 1
}
+ if recordBtn.isSelected {
+ delegate?.fieldRecordBar(self, stateChange: .start)
+ }
+ else{
+ delegate?.fieldRecordBar(self, stateChange: .stop)
+ }
}
@objc func pauseAction(){
- if rightItem.state == .recording {
+ if rightItem.state == .start {
+ rightItem.state = .pause
+ }
+ else if rightItem.state == .resume {
rightItem.state = .pause
}
else if rightItem.state == .pause {
- rightItem.state = .recording
+ rightItem.state = .resume
}
+ delegate?.fieldRecordBar(self, stateChange: rightItem.state)
}
class RecordBarItem: BaseView {
class RecordBarButton: BaseView {
let icon = UIImageView()
let titleLabel = UILabel()
- var state:RecordSate = .normal{
+ var state:RecordSate = .resume{
didSet{
- if state == .pause {
- titleLabel.text = "继续"
- icon.image = UIImage(named: "record_play")
+ if state == .start {
+ titleLabel.text = "暂停"
+ icon.image = UIImage(named: "record_pause")
}
- else if state == .recording{
+ else if state == .resume{
titleLabel.text = "暂停"
icon.image = UIImage(named: "record_pause")
}
+ else if state == .pause{
+ titleLabel.text = "继续"
+ icon.image = UIImage(named: "record_play")
+ }
}
}
//
import UIKit
-
+import JoyGemAI
+import AVFAudio
class FieldRecordingVC:BaseVC{
let toolBar = FieldRecordBar()
let textView = UITextView()
let rhythView = RhythView()
+ var messageList : [(String,UInt)] = []
+ var recordFilePath : String?
+
+
override func viewDidLoad() {
super.viewDidLoad()
}
override func setupViews() {
navBar.title = "现场录音"
navBar.rightView.setImage(UIImage(named: "help_icon"), for: .normal)
+ toolBar.delegate = self
textView.do { v in
- v.text = "好优美的一篇文章,山花落尽,我心犹青|||记得春日时分,山花绽放得那样热烈,鲜红的、明黄的、洁白的,仿佛将整片山野染成了一幅画。那时的心也如山花般明亮,轻快地跳跃在生活的每一个角落。然而,繁华易逝,花朵终会飘落。花落的那天,我站在同一片山坡上,听着风带走它们的碎影。那种空落感从心底涌起,像极了许多未能言说的遗憾,带着些许酸涩。"
v.font = .regular(14)
+ v.text = ""
v.textColor = .hexString("#121212")
v.contentInset = UIEdgeInsets(top: 0, left: 18, bottom: 0, right: 18)
}
make.bottom.equalTo(toolBar.snp.top)
}
}
+ override func setupData() {
+ JoyGemRecordManager.shared().delegate = self
+ PcmSound.sharedInstance().delegate = self;
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
override func navRightViewTapped() {
}
}
}
+
+extension FieldRecordingVC:FieldRecordBarDelegate{
+ func fieldRecordBar(_ bar: FieldRecordBar, languageChange language: String) {
+
+ }
+
+ func fieldRecordBar(_ bar: FieldRecordBar, stateChange state: RecordSate) {
+ if state == .start {
+ textView.text = ""
+ messageList.removeAll()
+ JoyGemRecordManager.shared().originalLanguage = kJoyGemAILocalizationZH
+ JoyGemRecordManager.shared().start()
+ }
+ if state == .resume{
+ JoyGemRecordManager.shared().resume()
+ }
+ else if state == .pause{
+ JoyGemRecordManager.shared().pause()
+ }
+ else if state == .stop{
+ JoyGemRecordManager.shared().stop()
+
+ let v = PopTextField()
+ v.show()
+ v.cancelTap = {
+
+ }
+ v.okTap = {
+
+ }
+ }
+ }
+}
+
+extension FieldRecordingVC : JoyGemRecordManagerDelegate {
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateAudioData data: Data) {
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateTranslate model: JoyGemAsrModel) {
+
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateAsr model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = messageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ messageList.append((model.text,model.index))
+ } else {
+ messageList[msg!] = (model.text,model.index)
+ }
+
+ textView.text = messageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+
+ let range = NSMakeRange(textView.text.count - 1, 1)
+ textView.scrollRangeToVisible(range)
+ }
+
+
+ func recordManager(_ manager: JoyGemRecordManager, update mode: JoyGemRecordMode) {
+ debugPrint("mode: \(mode)")
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+
+ func recordManagerStopped(_ manager: JoyGemRecordManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ YLprogressHUD.showAutoHiden("用户主动结束")
+ } else {
+ YLprogressHUD.showAutoHiden("自动结束")
+ ///判断当前蓝牙是否连接从而确定是否因为蓝牙断开造成的录音断开
+ }
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, onError code: JoyGemErrorCode) {
+
+ }
+}
+
+extension FieldRecordingVC : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ debugPrint("[frame:\(frames)]");
+ }
+}
--- /dev/null
+//
+// PopTextField.swift
+// ShenYin
+//
+// Created by liangshi on 2025/9/4.
+//
+
+import UIKit
+
+class PopTextField: BasePresentView2 {
+ let contentView = UIView()
+ private let titleLabel = UILabel()
+ private let textFiledBg = UIView()
+ private let textFiled = UITextField()
+ private let cancelButton = CustomButton()
+ private let okButton = CustomButton()
+ var cancelTap:(()->Void)?
+ var okTap:(()->Void)?
+
+ init() {
+ super.init()
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ override func setupSubView() {
+ super.setupSubView()
+ addSubview(contentView)
+ contentView.addSubviews([titleLabel,textFiledBg,cancelButton,okButton])
+ textFiledBg.addSubview(textFiled)
+ }
+ override func setupLayout() {
+ super.setupLayout()
+ contentView.do { (v) in
+ v.backgroundColor = .white
+ v.yc.setCornerRadius(20)
+ }
+
+ titleLabel.snp.makeConstraints { (m) in
+ m.top.equalToSuperview().inset(24)
+ m.left.right.equalToSuperview()
+ }
+ textFiledBg.snp.makeConstraints { (m) in
+ m.left.right.equalToSuperview().inset(24)
+ m.height.equalTo(45)
+ m.top.equalToSuperview().inset(69)
+ }
+ textFiled.snp.makeConstraints { (m) in
+ m.left.right.top.bottom.equalToSuperview().inset(12)
+ }
+ cancelButton.snp.makeConstraints { (m) in
+ m.top.equalToSuperview().inset(132)
+ m.height.equalTo(45)
+ m.width.equalTo(138)
+ m.left.equalToSuperview().inset(23)
+ }
+ okButton.snp.makeConstraints { (m) in
+ m.height.width.top.equalTo(cancelButton)
+ m.right.equalToSuperview().inset(23)
+ }
+ }
+
+ override func setupStyle() {
+ super.setupStyle()
+ contentView.snp.makeConstraints { make in
+ make.left.right.equalToSuperview().inset(18)
+ make.height.equalTo(200)
+ make.center.equalToSuperview()
+ }
+ titleLabel.do { (v) in
+ v.textColor = .rgb(0x121212)
+ v.font = .bold(20)
+ v.textAlignment = .center
+ v.text = "保存录音"
+ }
+ textFiledBg.do { v in
+ v.yc.setBorder(width: 2, color: .hexString("#0092E1"), radius: 10)
+
+ }
+ textFiled.do { v in
+ v.text = "7月17日 9点23分"
+ v.font = .bold(16)
+ v.textColor = .hexString("#121212")
+ }
+ cancelButton.do { (v) in
+ v.setTitle("删除", for: .normal)
+ v.titleLabel?.font = .bold(16)
+ v.setTitleColor(.hexString("#121212"), for: .normal)
+ v.backgroundColor = .hexString("#F7F7F7")
+ v.addTarget(self, action: #selector(cancelButtonAction), for: .touchUpInside)
+ v.yc.setCornerRadius(12)
+ }
+ okButton.do { (v) in
+ v.setTitle("确定", for: .normal)
+ v.titleLabel?.font = .bold(16)
+ v.setTitleColor(.white, for: .normal)
+ v.backgroundColor = UIColor.color(.theme)
+ v.addTarget(self, action: #selector(okButtonAction), for: .touchUpInside)
+ v.yc.setCornerRadius(12)
+
+ }
+ }
+ @objc func okButtonAction(){
+ okTap?()
+ hide()
+ }
+ @objc func cancelButtonAction(){
+ cancelTap?()
+ hide()
+ }
+}
+
-//
-// Untitled.swift
-// ShenYin
-//
-// Created by liangshi on 2025/8/27.
-//
+import UIKit
-class RhythView: BaseView {
-
-
- override func setupViews() {
- backgroundColor = .red
-
- }
-
- override func setupLayout() {
-
- }
-
+class RhythView: UIView {
+
}
// v.selectedIndex(4)
// v.show(animate: true)
-
+ App.shared.goToPage(AddDeviceVC())
}
@objc func addDeviceAction(){
- let vc = ScanDeviceVC()
+ let vc = AddDeviceVC()
self.navigationController?.pushViewController(vc, animated: true)
}
@objc func saveAction(){
--- /dev/null
+//
+// LanguagePickerTitle.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/29.
+//
+
+class LanguagePickerTitle: BaseView {
+ let titleLabel = UILabel()
+ let bottonView = UIView()
+ let leftLabel = LanguageItem()
+ let rightLabel = LanguageItem()
+ let switcIcon = UIImageView()
+
+ var isRight:Bool{
+ if rightLabel.isSelected{
+ return true
+ }
+ return false
+ }
+
+ override func setupViews() {
+ addSubviews([titleLabel,bottonView])
+ bottonView.addSubviews([leftLabel,rightLabel,switcIcon])
+ // backgroundColor = .blue
+
+ titleLabel.do { (v) in
+ v.textColor = .rgb(0x333333)
+ v.font = .semiBold(16)
+ v.textAlignment = .center
+ v.text = "请选择语言"
+ }
+
+ bottonView.do { v in
+// v.backgroundColor = .red
+ }
+
+ switcIcon.do { v in
+ v.image = UIImage(named: "language_switch_gray")
+ v.contentMode = .center
+ }
+ leftLabel.do { (v) in
+ v.yc.addTap(target: self, action: #selector(leftAction))
+ v.isSelected = true
+ }
+ rightLabel.do { (v) in
+ v.yc.addTap(target: self, action: #selector(rightAction))
+ v.isSelected = false
+ }
+ }
+
+ override func setupLayout() {
+ titleLabel.snp.makeConstraints { (m) in
+ m.top.equalToSuperview()
+ m.left.right.equalToSuperview().inset(60)
+ m.height.equalTo(50)
+ }
+ bottonView.snp.makeConstraints { make in
+ make.top.equalTo(titleLabel.snp.bottom)
+ make.bottom.equalToSuperview().inset(10)
+ make.height.equalTo(36)
+ make.width.equalToSuperview()
+ make.centerX.equalToSuperview()
+ }
+ switcIcon.snp.makeConstraints { make in
+ make.center.equalToSuperview()
+ make.size.equalTo(30)
+ }
+ leftLabel.snp.makeConstraints { make in
+ make.width.equalTo(130)
+ make.left.equalToSuperview().inset(18)
+ make.centerY.equalToSuperview()
+ make.height.equalTo(40)
+ }
+ rightLabel.snp.makeConstraints { make in
+ make.height.width.equalTo(leftLabel)
+ make.right.equalToSuperview().inset(18)
+ make.centerY.equalToSuperview()
+ }
+ }
+ @objc func leftAction(){
+ leftLabel.isSelected = true
+ rightLabel.isSelected = false
+ }
+ @objc func rightAction(){
+ leftLabel.isSelected = false
+ rightLabel.isSelected = true
+ }
+
+ class LanguageItem: BaseView {
+ let label = UILabel()
+ var isSelected:Bool = false{
+ didSet{
+ if isSelected {
+ label.textColor = .hexString("#0092E1")
+ label.yc.setBorder(width: 1.5, color: .hexString("#0092E1"), radius: 9)
+ }
+ else{
+ label.textColor = .hexString("#121212")
+ label.yc.setBorder(width: 1.5, color: .hexString("#121212"), radius: 9)
+ }
+ }
+ }
+
+ override func setupViews() {
+ addSubviews([label])
+ label.do { (v) in
+ v.font = .medium(14)
+ v.text = "中文"
+ v.textAlignment = .center
+ v.backgroundColor = .white
+ v.textColor = .hexString("#0092E1")
+ v.yc.setBorder(width: 1.5, color: .hexString("#0092E1"), radius: 9)
+ }
+ }
+
+ override func setupLayout() {
+ label.snp.makeConstraints { (m) in
+ m.edges.equalToSuperview()
+ }
+ }
+ }
+}
--- /dev/null
+//
+// LangeuageView.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/26.
+//
+
+import UIKit
+class LanguagePickerView: BasePresentView {
+ private let titleLabel = LanguagePickerTitle()
+ private let btn = UIButton(type: .custom)
+ private let tableView = UITableView(frame: .zero, style: .plain)
+ var list:[String] = GlobalConfig.tranlateLanguages
+ var selectedIndex = 0{
+ didSet{
+ tableView.reloadData()
+ }
+ }
+ var didSelected: ((Int,String)->Void)?
+ private var title:String = "请选择语言"
+
+ init(isLeft:Bool = true) {
+ if isLeft {
+ titleLabel.leftAction()
+ }
+ else{
+ titleLabel.rightAction()
+ }
+ let h = CGFloat(50 + list.count*52) + kSafeBtm
+ super.init(contentHeight:h)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+// LanguagePickerView(title: "", list: )
+ override func setupSubView() {
+ super.setupSubView()
+ contentView.addSubviews([titleLabel,btn,tableView])
+ }
+ override func setupLayout() {
+ super.setupLayout()
+ titleLabel.snp.makeConstraints { (m) in
+ m.top.equalToSuperview()
+ m.left.right.equalToSuperview()
+ }
+ btn.snp.makeConstraints { (m) in
+ m.centerY.equalTo(titleLabel)
+ m.right.equalToSuperview()
+ m.size.equalTo(60)
+ }
+ tableView.snp.makeConstraints { make in
+ make.left.right.bottom.equalToSuperview()
+ make.top.equalTo(titleLabel.snp.bottom)
+ make.bottom.equalToSuperview()
+ }
+ }
+
+ override func setupStyle() {
+ super.setupStyle()
+ contentView.backgroundColor = .white
+
+ btn.do { v in
+ v.isHidden = true
+ v.setImage(UIImage(named: "close_icon"), for: .normal)
+ v.addTarget(self, action: #selector(closeAction), for: .touchUpInside)
+ }
+ tableView.do { v in
+ v.isScrollEnabled = false
+ v.backgroundColor = .white
+ v.delegate = self
+ v.dataSource = self
+ v.rowHeight = 52
+ v.separatorStyle = .none
+ v.register(LanguagePickerView.SelectCell.self, forCellReuseIdentifier: LanguagePickerView.SelectCell.reuseID)
+ }
+ }
+ @objc func closeAction(){
+ hide()
+ }
+}
+extension LanguagePickerView:UITableViewDelegate,UITableViewDataSource {
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return list.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = LanguagePickerView.SelectCell.cell(withTableView: tableView, indexPath: indexPath)
+ cell.titleLabel.text = list[indexPath.row]
+ cell.selectedIcon.isHidden = selectedIndex != indexPath.row
+ return cell
+ }
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ selectedIndex = indexPath.row
+ tableView.reloadData()
+ didSelected?(titleLabel.isRight ? 1:0 ,list[selectedIndex])
+ hide()
+ }
+}
+
+extension LanguagePickerView {
+ class SelectCell: BaseTableViewCell {
+ let bgView = UIView()
+ let titleLabel = UILabel()
+ let selectedIcon = UIImageView()
+ let line = UIView()
+
+ var fontType:FontType = .min{
+ didSet{
+ titleLabel.text = fontType.title
+ }
+ }
+
+ var shareType:ShareType = .document{
+ didSet{
+ titleLabel.text = shareType.title
+ }
+ }
+
+
+ override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
+ super.init(style: style, reuseIdentifier: reuseIdentifier)
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+ override func setupViews() {
+ contentView.addSubview(bgView)
+ bgView.addSubviews([titleLabel,selectedIcon,line])
+
+ backgroundColor = .rgb(0xF7F7F7)
+ contentView.backgroundColor = .clear
+ selectionStyle = .none
+ bgView.do { v in
+ v.backgroundColor = UIColor.white
+ }
+ titleLabel.do { (v) in
+ v.textColor = .rgb(0x121212)
+ v.font = .bold(14)
+ v.textAlignment = .left
+ }
+
+ selectedIcon.image = UIImage(named: "cell_selected")
+ line.do { v in
+ v.backgroundColor = .hexString("#F2F2F2")
+ }
+ }
+
+ override func setupLayout() {
+ bgView.snp.makeConstraints { (m) in
+ m.left.right.equalToSuperview()
+ m.top.equalToSuperview()
+ m.bottom.equalToSuperview()
+ }
+ selectedIcon.snp.makeConstraints { (m) in
+ m.width.equalTo(21)
+ m.height.equalTo(16)
+ m.right.equalToSuperview().inset(21)
+ m.centerY.equalToSuperview()
+ }
+ titleLabel.snp.makeConstraints { (m) in
+ m.centerY.equalToSuperview()
+ m.left.equalToSuperview().offset(24)
+ m.height.equalToSuperview()
+ }
+ line.snp.makeConstraints { make in
+ make.left.right.equalToSuperview().inset(18)
+ make.bottom.equalToSuperview()
+ make.height.equalTo(0.4)
+ }
+ }
+ }
+
+}
+
--- /dev/null
+//
+// LanguageSelectItem.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/29.
+//
+
+class LanguageSelectItem: BaseView {
+ let bottonView = UIView()
+ let leftLabel = LanguageItem()
+ let rightLabel = LanguageItem()
+ let switcIcon = UIImageView()
+
+
+ override func setupViews() {
+ addSubviews([bottonView])
+ bottonView.addSubviews([leftLabel,rightLabel,switcIcon])
+// backgroundColor = .blue
+ switcIcon.do { v in
+ v.image = UIImage(named: "language_switch")
+ v.contentMode = .center
+// v.backgroundColor = .red
+ }
+ bottonView.do { v in
+ v.backgroundColor = .white
+ v.yc.setBorder(width: 1.5, color: .hexString("#0092E1"), radius: 9)
+ v.yc.addTap(target: self, action: #selector(switchAction))
+ }
+ leftLabel.do { (v) in
+ v.label.text = "中文"
+ v.yc.addTap(target: self, action: #selector(leftAction))
+ }
+ rightLabel.do { (v) in
+ v.label.text = "英文"
+ v.yc.addTap(target: self, action: #selector(rightAction))
+ }
+ }
+
+ override func setupLayout() {
+ bottonView.snp.makeConstraints { make in
+ make.top.bottom.equalToSuperview().inset(10)
+ make.height.equalTo(36)
+ make.centerX.equalToSuperview()
+ }
+ leftLabel.snp.makeConstraints { make in
+ make.left.equalToSuperview()
+ make.centerY.equalToSuperview()
+ }
+ switcIcon.snp.makeConstraints { make in
+ make.centerY.equalToSuperview()
+ make.size.equalTo(30)
+ make.left.equalTo(leftLabel.snp.right)
+ }
+ rightLabel.snp.makeConstraints { make in
+ make.left.equalTo(switcIcon.snp.right)
+ make.right.equalToSuperview()
+ make.centerY.equalToSuperview()
+ }
+ }
+ @objc func switchAction(){
+ let text1 = leftLabel.label.text
+ let text2 = rightLabel.label.text
+ leftLabel.label.text = text2
+ rightLabel.label.text = text1
+ }
+ @objc func leftAction(){
+ let v = LanguagePickerView(isLeft: true)
+ v.selectedIndex = v.list.firstIndex(where: {$0 == leftLabel.label.text}) ?? 0
+ v.show()
+ v.didSelected = {[weak self] (index,value) in
+ guard let self = self else { return }
+ if index == 0 {
+ leftLabel.label.text = value
+ }
+ else{
+ rightLabel.label.text = value
+ }
+ }
+ }
+ @objc func rightAction(){
+ let v = LanguagePickerView(isLeft: false)
+ v.selectedIndex = v.list.firstIndex(where: {$0 == rightLabel.label.text}) ?? 0
+ v.show()
+ v.didSelected = {[weak self] (index,value) in
+ guard let self = self else { return }
+ if index == 0 {
+ leftLabel.label.text = value
+ }
+ else{
+ rightLabel.label.text = value
+ }
+ }
+ }
+
+ class LanguageItem: BaseView {
+ let label = UILabel()
+
+ override func setupViews() {
+// backgroundColor = .yellow
+ addSubviews([label])
+ label.do { (v) in
+// v.backgroundColor = .green
+ v.textColor = .hexString("#0092E1")
+ v.font = .medium(14)
+ v.text = "中文"
+ v.textAlignment = .center
+ }
+ }
+
+ override func setupLayout() {
+ label.snp.makeConstraints { (m) in
+ m.edges.equalToSuperview().inset(15)
+ }
+ }
+ }
+}
+++ /dev/null
-//
-// LangeuageView.swift
-// ShenYin
-//
-// Created by liangshi on 2025/8/26.
-//
-
//
import UIKit
-
+import JoyGemAI
class TextTranlateVC:BaseVC{
+ let languageItem = LanguageSelectItem()
let toolBar = SendToolBar()
let tableView = UITableView(frame: CGRectZero, style: .plain)
- var dataList = [1,2,3]
+ var dataList:[TranslateCellModel] = []
override func viewDidLoad() {
super.viewDidLoad()
}
tableView.estimatedRowHeight = 60
tableView.separatorStyle = .none
tableView.register(TranslateCell.self, forCellReuseIdentifier: TranslateCell.reuseID)
- view.addSubview(tableView)
toolBar.textField.text = ""
toolBar.delegate = self
- view.addSubview(toolBar)
-
+ view.addSubviews([toolBar,languageItem,tableView])
+
}
override func setupLayout() {
+ languageItem.snp.makeConstraints { make in
+ make.width.centerX.equalToSuperview()
+ make.top.equalToSuperview().inset(kNavBtm)
+ }
toolBar.snp.makeConstraints { make in
make.width.centerX.equalToSuperview()
make.height.equalTo(52)
make.bottom.equalToSuperview().inset(20)
}
tableView.snp.makeConstraints { make in
- make.top.equalToSuperview().inset(80)
+ make.top.equalTo(languageItem.snp.bottom)
make.left.right.equalToSuperview()
make.bottom.equalTo(toolBar.snp.top)
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = TranslateCell.cell(withTableView: tableView, indexPath: indexPath)
- // cell.data = dataList[indexPath.row]
+ cell.data = dataList[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
extension TextTranlateVC:SendToolBarDelegate{
func sendToolBar(_ toolBar: SendToolBar, _ text: String) {
toolBar.textField.resignFirstResponder()
- // list.append(ChatCellModel(isSend:true,content:text))
- // tableView.reloadData()
- // scrollToBottom()
- // StartburstGlassesSdk.shared().chat.fireText(text)
+ dataList.append(TranslateCellModel(send: text,response: ""))
+ tableView.reloadData()
+ scrollToBottom()
+
+ let from = kJoyGemAILocalizationZH
+ let to = kJoyGemAILocalizationEN
+
+ JoyGemAIManager.shared().translate(text, from: from, to: to) {[weak self] result, finish in
+ guard let self = self else{return}
+ if !finish{
+ dataList.last!.response = dataList.last!.response + result
+ tableView.reloadData()
+ }
+
+ } error: { error in
+
+ }
+
}
}
// Created by liangshi on 2025/8/26.
//
+class TranslateCellModel{
+ var send = ""
+ var response = ""
+
+ init(send: String = "", response: String = "") {
+ self.send = send
+ self.response = response
+ }
+}
+
+
+
class TranslateCell:BaseTableViewCell{
let bgView = UIView()
v.backgroundColor = .white
}
originalLabel.do { v in
- v.text = "你好,欢迎使用AI翻译,点击下方按钮立即开始咱们的对话吧"
v.font = .regular(14)
v.textColor = .hexString("#606D80")
v.numberOfLines = 0
v.textAlignment = .left
}
translationLabel.do { v in
- v.text = "Hello, welcome to AI translation, click the button below now Let's start our conversation"
v.font = .regular(14)
v.textColor = .hexString("#121212")
v.numberOfLines = 0
}
}
- // var data:UBAiResponse!{
- // didSet{
- // if data.type == 1 {
- // bgView.snp.remakeConstraints { make in
- // make.top.bottom.equalToSuperview().inset(10)
- // make.right.equalToSuperview().inset(20)
- // }
- // }
- // else{
- //
- // bgView.snp.remakeConstraints { make in
- // make.top.bottom.equalToSuperview().inset(10)
- // make.left.equalToSuperview().inset(20)
- // }
- // }
- // msgLabel.text = data.totalContent
- // }
- // }
+ var data:TranslateCellModel!{
+ didSet{
+ originalLabel.text = data.send
+ translationLabel.text = data.response
+ }
+ }
}
let addView = AddDeviceSectionView()
let scanView = AddDeviceSectionView()
- override func viewDidLoad() {
- super.viewDidLoad()
-
- }
+
override func setupViews() {
self.navBar.title = ""
v.textAlignment = .center
}
addView.do { v in
+ v.icon.image = UIImage(named: "device_ble")
v.yc.setCornerRadius(20)
v.btn.set(title: "添加设备",font: .regular(14),style: .theme1, target: self, action: #selector(addAction))
}
scanView.do { v in
+ v.icon.image = UIImage(named: "device_qr")
v.yc.setCornerRadius(20)
v.btn.set(title: "扫码连接",font: .regular(14),style: .theme1, target: self, action: #selector(scanAction))
}
App.shared.goToPage(BleScanVC())
}
@objc func scanAction(){
-
+ App.shared.goToPage(QrVC())
}
}
class AddDeviceSectionView: BaseView {
backgroundColor = .white
addSubviews([icon,btn])
icon.do { v in
- v.backgroundColor = .lightGray
}
}
override func setupLayout() {
icon.snp.makeConstraints { make in
make.width.equalTo(106)
- make.height.equalTo(104)
+ make.height.equalTo(90)
make.centerX.equalToSuperview()
make.top.equalToSuperview().inset(38)
}
//
import UIKit
+import CoreBluetooth
+import DGActivityIndicatorView
class BleScanVC: BaseVC{
let tableView = UITableView(frame: .zero, style: .plain)
- let list:[MineCellType] = []
+ var list:[CBPeripheral] = []
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
override func setupViews() {
+ navBar.rightView.setImage(UIImage(named: "refresh_icon"), for: .normal)
tableView.do { v in
v.backgroundColor = .rgb(0xF7F7F7)
v.delegate = self
v.estimatedRowHeight = 76
v.separatorStyle = .none
v.register(BleScanCell.self, forCellReuseIdentifier: BleScanCell.reuseID)
- v.tableHeaderView = BleScanHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: 150))
+ v.tableHeaderView = BleScanHeaderView(frame: CGRect(x: 0, y: 0, width: kScreenWid, height: 280))
}
view.addSubview(tableView)
}
make.top.equalTo(kNavBtm)
}
}
+ override func setupData() {
+ BleManager.shared.discoverDeviceCallback = {[weak self] devices in
+ self?.list = devices
+ self?.tableView.reloadData()
+ }
+ startScan()
+ }
+ override func navRightViewTapped() {
+ startScan()
+ }
+ func startScan(){
+ list = []
+ tableView.reloadData()
+ BleManager.shared.startScanDevice()
+ }
}
extension BleScanVC:UITableViewDelegate,UITableViewDataSource {
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = BleScanCell.cell(withTableView: tableView, indexPath: indexPath)
-// cell.type = list[indexPath.row]
+ cell.model = list[indexPath.row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let data = list[indexPath.row]
-
+ BleManager.shared.connectPeripheral(data)
}
}
class BleScanHeaderView: BaseView {
+ let rippleView = DGActivityIndicatorView(type: .triplePulse,tintColor: UIColor.hexString("#0092E1"),size: 250)!
var radarImageView = UIImageView()
override func setupViews() {
backgroundColor = .clear
- addSubviews([radarImageView])
+// rippleView.backgroundColor = .red
+ addSubviews([rippleView,radarImageView])
+ rippleView.startAnimating()
radarImageView.do { v in
-// v.image = UIImage(named: "radar")
- v.backgroundColor = .lightGray
-
- let animation = CABasicAnimation.init(keyPath: "transform.rotation.z")
- animation.beginTime = 0.0
- animation.fromValue = 0.0
- animation.toValue = 2*Double.pi
- animation.duration = 2.5
- animation.repeatCount = MAXFLOAT
- v.layer.add(animation, forKey: "radar.transform.rotation.x")
+ v.image = UIImage(named: "device_logo")
+// v.backgroundColor = .lightGray
+//
+// let animation = CABasicAnimation.init(keyPath: "transform.rotation.z")
+// animation.beginTime = 0.0
+// animation.fromValue = 0.0
+// animation.toValue = 2*Double.pi
+// animation.duration = 2.5
+// animation.repeatCount = MAXFLOAT
+// v.layer.add(animation, forKey: "radar.transform.rotation.x")
}
}
override func setupLayout() {
radarImageView.snp.makeConstraints { make in
- make.size.equalTo(100)
- make.center.equalToSuperview().inset(30)
+ make.width.equalTo(58)
+ make.height.equalTo(46)
+ make.center.equalToSuperview()
+ }
+ rippleView.snp.makeConstraints { make in
+ make.size.equalTo(250)
+ make.center.equalToSuperview()
}
}
}
+
class BleScanCell: BaseTableViewCell {
let bgView = UIView()
let icon = UIImageView()
let titleLabel = UILabel()
-// var type:MineCellType = .user{
-// didSet{
-// titleLabel.text = type.title
-// }
-// }
+ var model:CBPeripheral!{
+ didSet{
+ titleLabel.text = model.name
+ titleLabel.text = titleLabel.text! + "\n" + model.identifier.uuidString
+ titleLabel.adjustsFontSizeToFitWidth = true
+ }
+ }
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
super.init(style: style, reuseIdentifier: reuseIdentifier)
v.textColor = .rgb(0x121212)
v.font = .bold(16)
v.textAlignment = .left
- v.text = "Deep Gen2 Max"
+ v.numberOfLines = 0
}
icon.image = UIImage(named: "scan_device")
}
titleLabel.snp.makeConstraints { (m) in
m.centerY.equalTo(icon)
m.left.equalTo(icon.snp.right).offset(15)
+ m.right.equalToSuperview().inset(15)
m.height.equalToSuperview()
}
+++ /dev/null
-//
-// DeviceCell.swift
-// Magpie
-//
-// Created by incar on 2024/1/3.
-//
-
-import UIKit
-import SnapKit
-
-class DeviceCell: BaseTableViewCell {
-
- var titleLabel = UILabel()
- var valueLabel = UILabel()
-
- override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
- super.init(style: style, reuseIdentifier: reuseIdentifier)
- setupView()
- setupStyle()
- setupLayout()
- }
-
- required init?(coder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- func setupView(){
- contentView.addSubview(titleLabel)
- contentView.addSubview(valueLabel)
-
- }
- func setupStyle(){
- titleLabel.do { v in
- v.textColor = .color(.primary)
- v.font = UIFont.systemFont(ofSize: 16)
- }
- valueLabel.do { v in
- v.textColor = .color(.secondary)
- v.font = UIFont.systemFont(ofSize: 14)
- }
-
- }
- override func setupLayout(){
- titleLabel.snp.makeConstraints { make in
- make.left.equalToSuperview().inset(20)
- make.centerY.equalToSuperview()
- }
- valueLabel.snp.makeConstraints({ make in
- make.right.equalToSuperview().inset(20)
- make.centerY.equalToSuperview()
- })
- }
-
- var model:ScanModel = ScanModel(){
- didSet{
- titleLabel.text = model.peripheral.name
- valueLabel.text = "\(model.peripheral.rssi)"
- }
- }
-}
--- /dev/null
+//
+// QrVC.swift
+// ShenYin
+//
+// Created by liangshi on 2025/8/29.
+//
+
+import swiftScan
+import UIKit
+
+class QrVC: LBXScanViewController {
+ let navBar = BaseNavigationBar()
+ var desLabel = UILabel()
+ var closeLabel = UILabel()
+ var btnFlash = UIButton()
+ var scanResult: ((String)->Void)?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ var style = LBXScanViewStyle()
+ style.animationImage = UIImage(named: "qrcode_scan_light_green")
+ self.scanStyle = style
+ //需要识别后的图像
+ setNeedCodeImage(needCodeImg: false)
+
+ //框向上移动10个像素
+ scanStyle?.centerUpOffset += 10
+ }
+
+ override func viewDidAppear(_ animated: Bool) {
+ super.viewDidAppear(animated)
+ drawBottomItems()
+ }
+
+ override func handleCodeResult(arrayResult: [LBXScanResult]) {
+
+ for result: LBXScanResult in arrayResult {
+ if let str = result.strScanned {
+ print(str)
+ }
+ }
+
+ let result: LBXScanResult = arrayResult[0]
+ k_log(result)
+ if let contnet = result.strScanned {
+ scanResult?(contnet)
+ }
+ navigationController?.popViewController(animated: true)
+ }
+
+
+ func drawBottomItems() {
+ navBar.delegate = self
+ view.addSubview(navBar)
+
+ desLabel.textAlignment = .center
+ desLabel.textColor = .white
+ desLabel.font = .regular(14)
+ view.addSubview(desLabel)
+ desLabel.snp.makeConstraints { make in
+ make.centerX.equalToSuperview()
+ let scanMaxHeight = (kScreenHei - kNavBtm)/2.0 + (kScreenWid - 120.0)/2.0
+ // make.bottom.equalToSuperview().inset(180.fitR)
+ make.top.equalToSuperview().offset(scanMaxHeight + 15.fitR)
+ }
+
+ btnFlash.yc.setCornerRadius(25.fitR)
+ btnFlash.setBackgroundImage(UIImage.yc.image(color: UIColor.white.withAlphaComponent(0.1), size: CGSize(width: 50.fitR,height: 50.fitR), cornerRadius: 25.fitR), for: .normal)
+ btnFlash.setBackgroundImage(UIImage.yc.image(color: UIColor.white.withAlphaComponent(0.4), size: CGSize(width: 50.fitR,height: 50.fitR), cornerRadius: 25.fitR), for: .selected)
+ btnFlash.setImage(UIImage(named: "qrcode_scan_btn_flash_down"), for:UIControl.State.selected)
+ btnFlash.setImage(UIImage(named: "qrcode_scan_btn_flash_nor"), for:UIControl.State.normal)
+ btnFlash.addTarget(self, action: #selector(QrVC.openOrCloseFlash), for: UIControl.Event.touchUpInside)
+ view.addSubview(btnFlash)
+ btnFlash.snp.makeConstraints { make in
+ make.size.equalTo(50.fitR)
+ make.centerX.equalToSuperview()
+ make.top.equalTo(desLabel.snp.bottom).offset(35.fitR)
+ }
+
+ closeLabel.textAlignment = .center
+ closeLabel.textColor = .white
+ closeLabel.font = .regular(12)
+ closeLabel.text = "开灯"
+ view.addSubview(closeLabel)
+
+
+ closeLabel.snp.makeConstraints { make in
+ make.centerX.equalToSuperview()
+ make.top.equalTo(btnFlash.snp.bottom).offset(6.fitR)
+ }
+ }
+
+ @objc func openOrCloseFlash() {
+ scanObj?.changeTorch()
+ btnFlash.isSelected = !btnFlash.isSelected
+ if btnFlash.isSelected {
+ closeLabel.text = "关灯"
+ }
+ else{
+ closeLabel.text = "开灯"
+ }
+ }
+}
+extension QrVC: BaseNavigationBarDelegate{
+ func navleftViewTapped() {
+ if let _ = self.presentingViewController {
+ self.dismiss(animated: true, completion: nil)
+ } else if let nav = self.navigationController {
+ nav.popViewController(animated: true)
+ }
+ }
+
+ func navRightViewTapped() {
+
+ }
+
+}
+++ /dev/null
-//
-// ScanDeviceVC.swift
-// Magpie
-//
-// Created by incar on 2024/1/3.
-//
-
-import UIKit
-import SnapKit
-import MJRefresh
-class ScanDeviceVC: BaseVC {
- var viewModel = BlueToothViewModel.shareModel
-
- lazy var tableview :UITableView = {
- let table = UITableView(frame: self.view.bounds, style: .plain)
- return table
- }()
-
-
-
- override func viewDidLoad() {
- super.viewDidLoad()
- // Do any additional setup after loading the view.
-
- setupView()
- setupLayout()
- setupStyle()
- setupViewModel()
-// refreshAction()
- }
- override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
-// self.tableview.mj_header?.endRefreshing()
-// if viewModel.selectedPeripheral == nil {
-// return
-// }
-// if viewModel.dataList.count > 0{
-// viewModel.sendFinishShishiShuJuXiang()
-// }
-// else{
-// YLProgressHUD.instance.showLoading()
-// viewModel.reRequestShishiShuJuXiang()
-// }
-// viewModel.sendFailure = {[weak self] in
-// self?.tableview.mj_header?.endRefreshing()
-// }
- }
-
- func setupView(){
- view.addSubview(tableview)
- }
- func setupStyle(){
-// navBar.title = "tab_data"
- tableview.do { v in
- v.delegate = self
- v.dataSource = self
- v.rowHeight = 60
- v.register(DeviceCell.self, forCellReuseIdentifier: DeviceCell.reuseID())
- v.mj_header = MJRefreshNormalHeader(refreshingTarget: self, refreshingAction: #selector(refreshAction))
- }
- }
- override func setupLayout() {
- tableview.snp.makeConstraints { make in
- make.top.equalToSuperview().inset(100)
- make.left.right.bottom.equalToSuperview()
- }
- }
- func setupViewModel(){
- viewModel.deviceListDidChange = {[weak self] in
- guard let self = self else { return }
- self.tableview.reloadData()
- self.tableview.mj_header?.endRefreshing()
- }
- }
- @objc func refreshAction(){
-// if viewModel.selectedPeripheral == nil {
-// self.tableview.mj_header?.endRefreshing()
-// return
-// }
-// if viewModel.dataList.count > 0{
-// viewModel.sendFinishShishiShuJuXiang()
-// }
-// else{
-// viewModel.reRequestShishiShuJuXiang()
-// }
- }
-}
-extension ScanDeviceVC:UITableViewDelegate,UITableViewDataSource{
- func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
- return viewModel.deviceList.count
- }
- func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
- let cell = DeviceCell.cell(withTableView: tableView, indexPath: indexPath)
- cell.model = viewModel.deviceList[indexPath.row];
- return cell
- }
-
- func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
- let model = viewModel.deviceList[indexPath.row]
- viewModel.bluetooth.connect(peripheral: model.peripheral)
- }
-}
-
setTitleColor(.white, for: .normal)
backgroundColor = UIColor.color(.theme)
}
- if style == .theme3 {
+ else if style == .theme3 {
setTitleColor(.hexString("#121212"), for: .normal)
backgroundColor = UIColor.white
titleLabel?.font = .regular(14)
textField.do { v in
v.backgroundColor = .clear
- v.placeholder = "请输入文字"
+ v.placeholder = "请输入..."
}
addSubview(bgView)
pod 'TZImagePickerController'#图片选择
pod 'netfox'#调试
# pod 'DoraemonKit'#调试
+
+ pod 'SocketRocket'#socket,AI用到
+ pod 'DGActivityIndicatorView'#扫描雷达
+# pod 'NVActivityIndicatorView', '~> 5.1.1' # 最新稳定版
+# pod 'EZAudio', '~> 1.1.0'
end
--- /dev/null
+.DS_Store
+build/
+*.pbxuser
+!default.pbxuser
+*.mode1v3
+!default.mode1v3
+*.mode2v3
+!default.mode2v3
+*.perspectivev3
+!default.perspectivev3
+xcuserdata
+*.xccheckout
+*.moved-aside
+DerivedData
+*.hmap
+*.ipa
+*.xcuserstate
--- /dev/null
+Pod::Spec.new do |s|
+ s.name = "EZAudio"
+ s.version = "1.1.5"
+ 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"
+ s.license = { :type => 'MIT', :file => 'LICENSE' }
+ s.author = { "Syed Haris Ali" => "syedhali07@gmail.com" }
+ s.ios.deployment_target = '8.0'
+ s.osx.deployment_target = '10.8'
+ s.source = { :git => "https://github.com/syedhali/EZAudio.git", :tag => s.version }
+ s.exclude_files = [ 'EZAudio/TPCircularBuffer.{h,c}', 'EZAudio/EZAudioiOS.h', 'EZAudio/EZAudioOSX.h' ]
+ s.ios.frameworks = 'AudioToolbox','AVFoundation','GLKit', 'Accelerate'
+ s.osx.frameworks = 'AudioToolbox','AudioUnit','CoreAudio','QuartzCore','OpenGL','GLKit', 'Accelerate'
+ s.requires_arc = true;
+ s.default_subspec = 'Full'
+ s.subspec 'Core' do |core|
+ core.source_files = 'EZAudio/*.{h,m,c}'
+ end
+
+ s.subspec 'Full' do |full|
+ full.dependency 'TPCircularBuffer', '1.1'
+ full.dependency 'EZAudio/Core'
+ end
+end
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 469F4D1E1B749FEC00666A46 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4CFE1B749FEC00666A46 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D1F1B749FEC00666A46 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4CFF1B749FEC00666A46 /* EZAudio.m */; };
+ 469F4D201B749FEC00666A46 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D001B749FEC00666A46 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D211B749FEC00666A46 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D011B749FEC00666A46 /* EZAudioDevice.m */; };
+ 469F4D221B749FEC00666A46 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D231B749FEC00666A46 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */; };
+ 469F4D241B749FEC00666A46 /* EZAudioFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D041B749FEC00666A46 /* EZAudioFFT.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D251B749FEC00666A46 /* EZAudioFFT.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D051B749FEC00666A46 /* EZAudioFFT.m */; };
+ 469F4D261B749FEC00666A46 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D061B749FEC00666A46 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D271B749FEC00666A46 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D071B749FEC00666A46 /* EZAudioFile.m */; };
+ 469F4D281B749FEC00666A46 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D291B749FEC00666A46 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */; };
+ 469F4D2A1B749FEC00666A46 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D2B1B749FEC00666A46 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */; };
+ 469F4D2C1B749FEC00666A46 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D2D1B749FEC00666A46 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */; };
+ 469F4D2E1B749FEC00666A46 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D2F1B749FEC00666A46 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */; };
+ 469F4D301B749FEC00666A46 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D311B749FEC00666A46 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */; };
+ 469F4D321B749FEC00666A46 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D331B749FEC00666A46 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */; };
+ 469F4D341B749FEC00666A46 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D141B749FEC00666A46 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D351B749FEC00666A46 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D151B749FEC00666A46 /* EZMicrophone.m */; };
+ 469F4D361B749FEC00666A46 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D161B749FEC00666A46 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D371B749FEC00666A46 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D171B749FEC00666A46 /* EZOutput.m */; };
+ 469F4D381B749FEC00666A46 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D181B749FEC00666A46 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D391B749FEC00666A46 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D191B749FEC00666A46 /* EZPlot.m */; };
+ 469F4D3A1B749FEC00666A46 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1A1B749FEC00666A46 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 469F4D3B1B749FEC00666A46 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1B1B749FEC00666A46 /* EZRecorder.m */; };
+ 469F4D3C1B749FEC00666A46 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */; };
+ 469F4D3D1B749FEC00666A46 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB31BBBDD6D00A8A048 /* EZAudio.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4CFE1B749FEC00666A46 /* EZAudio.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB41BBBDD6D00A8A048 /* EZAudioDevice.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D001B749FEC00666A46 /* EZAudioDevice.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB51BBBDD6D00A8A048 /* EZAudioDisplayLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB61BBBDD6D00A8A048 /* EZAudioFFT.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D041B749FEC00666A46 /* EZAudioFFT.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB71BBBDD6D00A8A048 /* EZAudioFile.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D061B749FEC00666A46 /* EZAudioFile.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB81BBBDD6D00A8A048 /* EZAudioFloatConverter.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BB91BBBDD6D00A8A048 /* EZAudioFloatData.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBA1BBBDD6D00A8A048 /* EZAudioPlayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBB1BBBDD6D00A8A048 /* EZAudioPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBC1BBBDD6D00A8A048 /* EZAudioPlotGL.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBD1BBBDD6D00A8A048 /* EZAudioUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBE1BBBDD6D00A8A048 /* EZMicrophone.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D141B749FEC00666A46 /* EZMicrophone.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BBF1BBBDD6D00A8A048 /* EZOutput.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D161B749FEC00666A46 /* EZOutput.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BC01BBBDD6D00A8A048 /* EZPlot.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D181B749FEC00666A46 /* EZPlot.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BC11BBBDD6D00A8A048 /* EZRecorder.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1A1B749FEC00666A46 /* EZRecorder.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BC21BBBDD6E00A8A048 /* TPCircularBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BC31BBBDD7E00A8A048 /* EZAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4CFF1B749FEC00666A46 /* EZAudio.m */; };
+ 8A5A4BC41BBBDD7E00A8A048 /* EZAudioDevice.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D011B749FEC00666A46 /* EZAudioDevice.m */; };
+ 8A5A4BC51BBBDD7E00A8A048 /* EZAudioDisplayLink.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */; };
+ 8A5A4BC61BBBDD7E00A8A048 /* EZAudioFFT.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D051B749FEC00666A46 /* EZAudioFFT.m */; };
+ 8A5A4BC71BBBDD7E00A8A048 /* EZAudioFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D071B749FEC00666A46 /* EZAudioFile.m */; };
+ 8A5A4BC81BBBDD7E00A8A048 /* EZAudioFloatConverter.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */; };
+ 8A5A4BC91BBBDD7E00A8A048 /* EZAudioFloatData.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */; };
+ 8A5A4BCA1BBBDD7E00A8A048 /* EZAudioPlayer.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */; };
+ 8A5A4BCB1BBBDD7E00A8A048 /* EZAudioPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */; };
+ 8A5A4BCC1BBBDD7E00A8A048 /* EZAudioPlotGL.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */; };
+ 8A5A4BCD1BBBDD7E00A8A048 /* EZAudioUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */; };
+ 8A5A4BCE1BBBDD7E00A8A048 /* EZMicrophone.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D151B749FEC00666A46 /* EZMicrophone.m */; };
+ 8A5A4BCF1BBBDD7E00A8A048 /* EZOutput.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D171B749FEC00666A46 /* EZOutput.m */; };
+ 8A5A4BD01BBBDD7E00A8A048 /* EZPlot.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D191B749FEC00666A46 /* EZPlot.m */; };
+ 8A5A4BD11BBBDD7E00A8A048 /* EZRecorder.m in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1B1B749FEC00666A46 /* EZRecorder.m */; };
+ 8A5A4BD21BBBDE2800A8A048 /* TPCircularBuffer.c in Sources */ = {isa = PBXBuildFile; fileRef = 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */; };
+ 8A5A4BF31BBBFFA000A8A048 /* EZAudioOSX.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 8A5A4BF41BBC025600A8A048 /* EZAudioiOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */; settings = {ATTRIBUTES = (Public, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 469F4CF31B749F7800666A46 /* EZAudioiOS.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudioiOS.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 469F4CF81B749F7800666A46 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 469F4CFE1B749FEC00666A46 /* EZAudio.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudio.h; sourceTree = "<group>"; };
+ 469F4CFF1B749FEC00666A46 /* EZAudio.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudio.m; sourceTree = "<group>"; };
+ 469F4D001B749FEC00666A46 /* EZAudioDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDevice.h; sourceTree = "<group>"; };
+ 469F4D011B749FEC00666A46 /* EZAudioDevice.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDevice.m; sourceTree = "<group>"; };
+ 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioDisplayLink.h; sourceTree = "<group>"; };
+ 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioDisplayLink.m; sourceTree = "<group>"; };
+ 469F4D041B749FEC00666A46 /* EZAudioFFT.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFFT.h; sourceTree = "<group>"; };
+ 469F4D051B749FEC00666A46 /* EZAudioFFT.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFFT.m; sourceTree = "<group>"; };
+ 469F4D061B749FEC00666A46 /* EZAudioFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFile.h; sourceTree = "<group>"; };
+ 469F4D071B749FEC00666A46 /* EZAudioFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFile.m; sourceTree = "<group>"; };
+ 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatConverter.h; sourceTree = "<group>"; };
+ 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatConverter.m; sourceTree = "<group>"; };
+ 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioFloatData.h; sourceTree = "<group>"; };
+ 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioFloatData.m; sourceTree = "<group>"; };
+ 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlayer.h; sourceTree = "<group>"; };
+ 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlayer.m; sourceTree = "<group>"; };
+ 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlot.h; sourceTree = "<group>"; };
+ 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlot.m; sourceTree = "<group>"; };
+ 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioPlotGL.h; sourceTree = "<group>"; };
+ 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioPlotGL.m; sourceTree = "<group>"; };
+ 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioUtilities.h; sourceTree = "<group>"; };
+ 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZAudioUtilities.m; sourceTree = "<group>"; };
+ 469F4D141B749FEC00666A46 /* EZMicrophone.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZMicrophone.h; sourceTree = "<group>"; };
+ 469F4D151B749FEC00666A46 /* EZMicrophone.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZMicrophone.m; sourceTree = "<group>"; };
+ 469F4D161B749FEC00666A46 /* EZOutput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZOutput.h; sourceTree = "<group>"; };
+ 469F4D171B749FEC00666A46 /* EZOutput.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZOutput.m; sourceTree = "<group>"; };
+ 469F4D181B749FEC00666A46 /* EZPlot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZPlot.h; sourceTree = "<group>"; };
+ 469F4D191B749FEC00666A46 /* EZPlot.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZPlot.m; sourceTree = "<group>"; };
+ 469F4D1A1B749FEC00666A46 /* EZRecorder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZRecorder.h; sourceTree = "<group>"; };
+ 469F4D1B1B749FEC00666A46 /* EZRecorder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = EZRecorder.m; sourceTree = "<group>"; };
+ 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = TPCircularBuffer.c; sourceTree = "<group>"; };
+ 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TPCircularBuffer.h; sourceTree = "<group>"; };
+ 8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = EZAudioOSX.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioiOS.h; sourceTree = "<group>"; };
+ 8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EZAudioOSX.h; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 469F4CEF1B749F7800666A46 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8A5A4B981BBBDCB200A8A048 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 469F4CE91B749F7800666A46 = {
+ isa = PBXGroup;
+ children = (
+ 469F4CF51B749F7800666A46 /* EZAudio */,
+ 469F4CF41B749F7800666A46 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 469F4CF41B749F7800666A46 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 469F4CF31B749F7800666A46 /* EZAudioiOS.framework */,
+ 8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 469F4CF51B749F7800666A46 /* EZAudio */ = {
+ isa = PBXGroup;
+ children = (
+ 469F4CFE1B749FEC00666A46 /* EZAudio.h */,
+ 469F4CFF1B749FEC00666A46 /* EZAudio.m */,
+ 469F4D001B749FEC00666A46 /* EZAudioDevice.h */,
+ 469F4D011B749FEC00666A46 /* EZAudioDevice.m */,
+ 469F4D021B749FEC00666A46 /* EZAudioDisplayLink.h */,
+ 469F4D031B749FEC00666A46 /* EZAudioDisplayLink.m */,
+ 469F4D041B749FEC00666A46 /* EZAudioFFT.h */,
+ 469F4D051B749FEC00666A46 /* EZAudioFFT.m */,
+ 469F4D061B749FEC00666A46 /* EZAudioFile.h */,
+ 469F4D071B749FEC00666A46 /* EZAudioFile.m */,
+ 469F4D081B749FEC00666A46 /* EZAudioFloatConverter.h */,
+ 469F4D091B749FEC00666A46 /* EZAudioFloatConverter.m */,
+ 469F4D0A1B749FEC00666A46 /* EZAudioFloatData.h */,
+ 469F4D0B1B749FEC00666A46 /* EZAudioFloatData.m */,
+ 469F4D0C1B749FEC00666A46 /* EZAudioPlayer.h */,
+ 469F4D0D1B749FEC00666A46 /* EZAudioPlayer.m */,
+ 469F4D0E1B749FEC00666A46 /* EZAudioPlot.h */,
+ 469F4D0F1B749FEC00666A46 /* EZAudioPlot.m */,
+ 469F4D101B749FEC00666A46 /* EZAudioPlotGL.h */,
+ 469F4D111B749FEC00666A46 /* EZAudioPlotGL.m */,
+ 469F4D121B749FEC00666A46 /* EZAudioUtilities.h */,
+ 469F4D131B749FEC00666A46 /* EZAudioUtilities.m */,
+ 469F4D141B749FEC00666A46 /* EZMicrophone.h */,
+ 469F4D151B749FEC00666A46 /* EZMicrophone.m */,
+ 469F4D161B749FEC00666A46 /* EZOutput.h */,
+ 469F4D171B749FEC00666A46 /* EZOutput.m */,
+ 469F4D181B749FEC00666A46 /* EZPlot.h */,
+ 469F4D191B749FEC00666A46 /* EZPlot.m */,
+ 469F4D1A1B749FEC00666A46 /* EZRecorder.h */,
+ 469F4D1B1B749FEC00666A46 /* EZRecorder.m */,
+ 469F4D1C1B749FEC00666A46 /* TPCircularBuffer.c */,
+ 469F4D1D1B749FEC00666A46 /* TPCircularBuffer.h */,
+ 8A5A4BEF1BBBFF0A00A8A048 /* EZAudioiOS.h */,
+ 8A5A4BF11BBBFF5600A8A048 /* EZAudioOSX.h */,
+ 469F4D3E1B749FF000666A46 /* Supporting Files */,
+ );
+ path = EZAudio;
+ sourceTree = "<group>";
+ };
+ 469F4D3E1B749FF000666A46 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 469F4CF81B749F7800666A46 /* Info.plist */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 469F4CF01B749F7800666A46 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8A5A4BF41BBC025600A8A048 /* EZAudioiOS.h in Headers */,
+ 469F4D301B749FEC00666A46 /* EZAudioPlotGL.h in Headers */,
+ 469F4D2A1B749FEC00666A46 /* EZAudioFloatData.h in Headers */,
+ 469F4D221B749FEC00666A46 /* EZAudioDisplayLink.h in Headers */,
+ 469F4D201B749FEC00666A46 /* EZAudioDevice.h in Headers */,
+ 469F4D2E1B749FEC00666A46 /* EZAudioPlot.h in Headers */,
+ 469F4D2C1B749FEC00666A46 /* EZAudioPlayer.h in Headers */,
+ 469F4D381B749FEC00666A46 /* EZPlot.h in Headers */,
+ 469F4D261B749FEC00666A46 /* EZAudioFile.h in Headers */,
+ 469F4D341B749FEC00666A46 /* EZMicrophone.h in Headers */,
+ 469F4D361B749FEC00666A46 /* EZOutput.h in Headers */,
+ 469F4D1E1B749FEC00666A46 /* EZAudio.h in Headers */,
+ 469F4D3D1B749FEC00666A46 /* TPCircularBuffer.h in Headers */,
+ 469F4D3A1B749FEC00666A46 /* EZRecorder.h in Headers */,
+ 469F4D321B749FEC00666A46 /* EZAudioUtilities.h in Headers */,
+ 469F4D281B749FEC00666A46 /* EZAudioFloatConverter.h in Headers */,
+ 469F4D241B749FEC00666A46 /* EZAudioFFT.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8A5A4B991BBBDCB200A8A048 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8A5A4BF31BBBFFA000A8A048 /* EZAudioOSX.h in Headers */,
+ 8A5A4BB31BBBDD6D00A8A048 /* EZAudio.h in Headers */,
+ 8A5A4BB41BBBDD6D00A8A048 /* EZAudioDevice.h in Headers */,
+ 8A5A4BB51BBBDD6D00A8A048 /* EZAudioDisplayLink.h in Headers */,
+ 8A5A4BB61BBBDD6D00A8A048 /* EZAudioFFT.h in Headers */,
+ 8A5A4BB71BBBDD6D00A8A048 /* EZAudioFile.h in Headers */,
+ 8A5A4BB81BBBDD6D00A8A048 /* EZAudioFloatConverter.h in Headers */,
+ 8A5A4BB91BBBDD6D00A8A048 /* EZAudioFloatData.h in Headers */,
+ 8A5A4BBA1BBBDD6D00A8A048 /* EZAudioPlayer.h in Headers */,
+ 8A5A4BBB1BBBDD6D00A8A048 /* EZAudioPlot.h in Headers */,
+ 8A5A4BBC1BBBDD6D00A8A048 /* EZAudioPlotGL.h in Headers */,
+ 8A5A4BBD1BBBDD6D00A8A048 /* EZAudioUtilities.h in Headers */,
+ 8A5A4BBE1BBBDD6D00A8A048 /* EZMicrophone.h in Headers */,
+ 8A5A4BBF1BBBDD6D00A8A048 /* EZOutput.h in Headers */,
+ 8A5A4BC01BBBDD6D00A8A048 /* EZPlot.h in Headers */,
+ 8A5A4BC11BBBDD6D00A8A048 /* EZRecorder.h in Headers */,
+ 8A5A4BC21BBBDD6E00A8A048 /* TPCircularBuffer.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 469F4CF21B749F7800666A46 /* EZAudioiOS */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 469F4CFB1B749F7800666A46 /* Build configuration list for PBXNativeTarget "EZAudioiOS" */;
+ buildPhases = (
+ 469F4CEE1B749F7800666A46 /* Sources */,
+ 469F4CEF1B749F7800666A46 /* Frameworks */,
+ 469F4CF01B749F7800666A46 /* Headers */,
+ 469F4CF11B749F7800666A46 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = EZAudioiOS;
+ productName = EZAudio;
+ productReference = 469F4CF31B749F7800666A46 /* EZAudioiOS.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+ 8A5A4B9B1BBBDCB200A8A048 /* EZAudioOSX */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 8A5A4BAD1BBBDCB200A8A048 /* Build configuration list for PBXNativeTarget "EZAudioOSX" */;
+ buildPhases = (
+ 8A5A4B971BBBDCB200A8A048 /* Sources */,
+ 8A5A4B981BBBDCB200A8A048 /* Frameworks */,
+ 8A5A4B991BBBDCB200A8A048 /* Headers */,
+ 8A5A4B9A1BBBDCB200A8A048 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = EZAudioOSX;
+ productName = EZAudioOSX;
+ productReference = 8A5A4B9C1BBBDCB200A8A048 /* EZAudioOSX.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 469F4CEA1B749F7800666A46 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0700;
+ ORGANIZATIONNAME = "Andrew Breckenridge";
+ TargetAttributes = {
+ 469F4CF21B749F7800666A46 = {
+ CreatedOnToolsVersion = 7.0;
+ };
+ 8A5A4B9B1BBBDCB200A8A048 = {
+ CreatedOnToolsVersion = 7.0;
+ };
+ };
+ };
+ buildConfigurationList = 469F4CED1B749F7800666A46 /* Build configuration list for PBXProject "EZAudio" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ );
+ mainGroup = 469F4CE91B749F7800666A46;
+ productRefGroup = 469F4CF41B749F7800666A46 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 469F4CF21B749F7800666A46 /* EZAudioiOS */,
+ 8A5A4B9B1BBBDCB200A8A048 /* EZAudioOSX */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 469F4CF11B749F7800666A46 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8A5A4B9A1BBBDCB200A8A048 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 469F4CEE1B749F7800666A46 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 469F4D2F1B749FEC00666A46 /* EZAudioPlot.m in Sources */,
+ 469F4D2D1B749FEC00666A46 /* EZAudioPlayer.m in Sources */,
+ 469F4D251B749FEC00666A46 /* EZAudioFFT.m in Sources */,
+ 469F4D391B749FEC00666A46 /* EZPlot.m in Sources */,
+ 469F4D291B749FEC00666A46 /* EZAudioFloatConverter.m in Sources */,
+ 469F4D1F1B749FEC00666A46 /* EZAudio.m in Sources */,
+ 469F4D3C1B749FEC00666A46 /* TPCircularBuffer.c in Sources */,
+ 469F4D3B1B749FEC00666A46 /* EZRecorder.m in Sources */,
+ 469F4D311B749FEC00666A46 /* EZAudioPlotGL.m in Sources */,
+ 469F4D331B749FEC00666A46 /* EZAudioUtilities.m in Sources */,
+ 469F4D2B1B749FEC00666A46 /* EZAudioFloatData.m in Sources */,
+ 469F4D351B749FEC00666A46 /* EZMicrophone.m in Sources */,
+ 469F4D271B749FEC00666A46 /* EZAudioFile.m in Sources */,
+ 469F4D231B749FEC00666A46 /* EZAudioDisplayLink.m in Sources */,
+ 469F4D371B749FEC00666A46 /* EZOutput.m in Sources */,
+ 469F4D211B749FEC00666A46 /* EZAudioDevice.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8A5A4B971BBBDCB200A8A048 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8A5A4BD21BBBDE2800A8A048 /* TPCircularBuffer.c in Sources */,
+ 8A5A4BC31BBBDD7E00A8A048 /* EZAudio.m in Sources */,
+ 8A5A4BC41BBBDD7E00A8A048 /* EZAudioDevice.m in Sources */,
+ 8A5A4BC51BBBDD7E00A8A048 /* EZAudioDisplayLink.m in Sources */,
+ 8A5A4BC61BBBDD7E00A8A048 /* EZAudioFFT.m in Sources */,
+ 8A5A4BC71BBBDD7E00A8A048 /* EZAudioFile.m in Sources */,
+ 8A5A4BC81BBBDD7E00A8A048 /* EZAudioFloatConverter.m in Sources */,
+ 8A5A4BC91BBBDD7E00A8A048 /* EZAudioFloatData.m in Sources */,
+ 8A5A4BCA1BBBDD7E00A8A048 /* EZAudioPlayer.m in Sources */,
+ 8A5A4BCB1BBBDD7E00A8A048 /* EZAudioPlot.m in Sources */,
+ 8A5A4BCC1BBBDD7E00A8A048 /* EZAudioPlotGL.m in Sources */,
+ 8A5A4BCD1BBBDD7E00A8A048 /* EZAudioUtilities.m in Sources */,
+ 8A5A4BCE1BBBDD7E00A8A048 /* EZMicrophone.m in Sources */,
+ 8A5A4BCF1BBBDD7E00A8A048 /* EZOutput.m in Sources */,
+ 8A5A4BD01BBBDD7E00A8A048 /* EZPlot.m in Sources */,
+ 8A5A4BD11BBBDD7E00A8A048 /* EZRecorder.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 469F4CF91B749F7800666A46 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ CURRENT_PROJECT_VERSION = 1;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+ 469F4CFA1B749F7800666A46 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ CURRENT_PROJECT_VERSION = 1;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+ 469F4CFC1B749F7800666A46 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ INFOPLIST_FILE = EZAudio/Info.plist;
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioiOS;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 469F4CFD1B749F7800666A46 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ INFOPLIST_FILE = EZAudio/Info.plist;
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioiOS;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+ 8A5A4BAE1BBBDCB200A8A048 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COMBINE_HIDPI_IMAGES = YES;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ FRAMEWORK_VERSION = A;
+ INFOPLIST_FILE = "$(SRCROOT)/EZAudio/Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioOSX;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ SKIP_INSTALL = YES;
+ };
+ name = Debug;
+ };
+ 8A5A4BAF1BBBDCB200A8A048 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COMBINE_HIDPI_IMAGES = YES;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ FRAMEWORK_VERSION = A;
+ INFOPLIST_FILE = "$(SRCROOT)/EZAudio/Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = ezaudio.EZAudioOSX;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SDKROOT = macosx;
+ SKIP_INSTALL = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 469F4CED1B749F7800666A46 /* Build configuration list for PBXProject "EZAudio" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 469F4CF91B749F7800666A46 /* Debug */,
+ 469F4CFA1B749F7800666A46 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 469F4CFB1B749F7800666A46 /* Build configuration list for PBXNativeTarget "EZAudioiOS" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 469F4CFC1B749F7800666A46 /* Debug */,
+ 469F4CFD1B749F7800666A46 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 8A5A4BAD1BBBDCB200A8A048 /* Build configuration list for PBXNativeTarget "EZAudioOSX" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 8A5A4BAE1BBBDCB200A8A048 /* Debug */,
+ 8A5A4BAF1BBBDCB200A8A048 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 469F4CEA1B749F7800666A46 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:EZAudio.xcodeproj">
+ </FileRef>
+</Workspace>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0700"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
+ BuildableName = "EZAudioOSX.framework"
+ BlueprintName = "EZAudioOSX"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <Testables>
+ <TestableReference
+ skipped = "NO">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8A5A4BA41BBBDCB200A8A048"
+ BuildableName = "EZAudioOSXTests.xctest"
+ BlueprintName = "EZAudioOSXTests"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </TestableReference>
+ </Testables>
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
+ BuildableName = "EZAudioOSX.framework"
+ BlueprintName = "EZAudioOSX"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
+ BuildableName = "EZAudioOSX.framework"
+ BlueprintName = "EZAudioOSX"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "8A5A4B9B1BBBDCB200A8A048"
+ BuildableName = "EZAudioOSX.framework"
+ BlueprintName = "EZAudioOSX"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "0700"
+ version = "1.3">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "469F4CF21B749F7800666A46"
+ BuildableName = "EZAudioiOS.framework"
+ BlueprintName = "EZAudioiOS"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES">
+ <Testables>
+ </Testables>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "469F4CF21B749F7800666A46"
+ BuildableName = "EZAudioiOS.framework"
+ BlueprintName = "EZAudioiOS"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ <AdditionalOptions>
+ </AdditionalOptions>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <MacroExpansion>
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "469F4CF21B749F7800666A46"
+ BuildableName = "EZAudioiOS.framework"
+ BlueprintName = "EZAudioiOS"
+ ReferencedContainer = "container:EZAudio.xcodeproj">
+ </BuildableReference>
+ </MacroExpansion>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
--- /dev/null
+//
+// EZAudio.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 11/21/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+//! Project version number for teat.
+FOUNDATION_EXPORT double EZAudioVersionNumber;
+
+//! Project version string for teat.
+FOUNDATION_EXPORT const unsigned char EZAudioVersionString[];
+
+//------------------------------------------------------------------------------
+#pragma mark - Core Components
+//------------------------------------------------------------------------------
+
+#import "EZAudioDevice.h"
+#import "EZAudioFile.h"
+#import "EZMicrophone.h"
+#import "EZOutput.h"
+#import "EZRecorder.h"
+#import "EZAudioPlayer.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Interface Components
+//------------------------------------------------------------------------------
+
+#import "EZPlot.h"
+#import "EZAudioDisplayLink.h"
+#import "EZAudioPlot.h"
+#import "EZAudioPlotGL.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility Components
+//------------------------------------------------------------------------------
+
+#import "EZAudioFFT.h"
+#import "EZAudioFloatConverter.h"
+#import "EZAudioFloatData.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+
+/**
+ 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.
+
+ Class methods for EZAudio are provided as utility methods used throughout the other modules within the framework. For instance, these methods help make sense of error codes (checkResult:operation:), map values betwen coordinate systems (MAP:leftMin:leftMax:rightMin:rightMax:), calculate root mean squared values for buffers (RMS:length:), etc.
+
+ @warning As of 1.0 these methods have been moved over to `EZAudioUtilities` to allow using specific modules without requiring the whole library.
+ */
+@interface EZAudio : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Debugging
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Debugging EZAudio
+///-----------------------------------------------------------
+
+/**
+ Globally sets whether or not the program should exit if a `checkResult:operation:` operation fails. Currently the behavior on EZAudio is to quit if a `checkResult:operation:` fails, but this is not desirable in any production environment. Internally there are a lot of `checkResult:operation:` operations used on all the core classes. This should only ever be set to NO in production environments since a `checkResult:operation:` failing means something breaking has likely happened.
+ @param shouldExitOnCheckResultFail A BOOL indicating whether or not the running program should exist due to a `checkResult:operation:` fail.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a flag indicating whether or not the program will exit if a `checkResult:operation:` fails.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A BOOL indicating whether or not the program will exit if a `checkResult:operation:` fails.
+ */
++ (BOOL)shouldExitOnCheckResultFail __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioBufferList Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name AudioBufferList Utility
+///-----------------------------------------------------------
+
+/**
+ Allocates an AudioBufferList structure. Make sure to call freeBufferList when done using AudioBufferList or it will leak.
+ @param frames The number of frames that will be stored within each audio buffer
+ @param channels The number of channels (e.g. 2 for stereo, 1 for mono, etc.)
+ @param interleaved Whether the samples will be interleaved (if not it will be assumed to be non-interleaved and each channel will have an AudioBuffer allocated)
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return An AudioBufferList struct that has been allocated in memory
+ */
++ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+ interleaved:(BOOL)interleaved __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Allocates an array of float arrays given the number of frames needed to store in each float array.
+ @param frames A UInt32 representing the number of frames to store in each float buffer
+ @param channels A UInt32 representing the number of channels (i.e. the number of float arrays to allocate)
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return An array of float arrays, each the length of the number of frames specified
+ */
++ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Deallocates an AudioBufferList structure from memory.
+ @param bufferList A pointer to the buffer list you would like to free
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)freeBufferList:(AudioBufferList *)bufferList __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Deallocates an array of float buffers
+ @param buffers An array of float arrays
+ @param channels A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioStreamBasicDescription Utilties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Creating An AudioStreamBasicDescription
+///-----------------------------------------------------------
+
+/**
+ Creates a signed-integer, interleaved AudioStreamBasicDescription for the number of channels specified for an AIFF format.
+ @param channels The desired number of channels
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an AudioStreamBasicDescription for the iLBC narrow band speech codec.
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a float-based, non-interleaved AudioStreamBasicDescription for the number of channels specified.
+ @param channels A UInt32 representing the number of channels.
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A float-based AudioStreamBasicDescription with the number of channels specified.
+ */
++ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an AudioStreamBasicDescription for an M4A AAC format.
+ @param channels The desired number of channels
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a single-channel, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a single-channel, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `monoFloatFormatWithSampleRate:`).
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `stereoFloatNonInterleavedFormatWithSampleRate:`).
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, interleaved, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+// @name AudioStreamBasicDescription Helper Functions
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to see if it is a float-based format (as opposed to a signed integer based format).
+ @param asbd A valid AudioStreamBasicDescription
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.
+ */
++ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to check for an interleaved flag (samples are
+ stored in one buffer one after another instead of two (or n channels) parallel buffers
+ @param asbd A valid AudioStreamBasicDescription
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved
+ */
++ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to see if it is a linear PCM format (uncompressed,
+ 1 frame per packet)
+ @param asbd A valid AudioStreamBasicDescription
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.
+ */
++ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
+
+///-----------------------------------------------------------
+/// @name AudioStreamBasicDescription Utilities
+///-----------------------------------------------------------
+
+/**
+ Nicely logs out the contents of an AudioStreamBasicDescription struct
+ @param asbd The AudioStreamBasicDescription struct with content to print out
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)printASBD:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Converts seconds into a string formatted as MM:SS
+ @param seconds An NSTimeInterval representing the number of seconds
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return An NSString instance formatted as MM:SS from the seconds provided.
+ */
++ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a string to use when logging out the contents of an AudioStreamBasicDescription
+ @param asbd A valid AudioStreamBasicDescription struct.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return An NSString representing the contents of the AudioStreamBasicDescription.
+ */
++ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Just a wrapper around the setCanonical function provided in the Core Audio Utility C++ class.
+ @param asbd The AudioStreamBasicDescription structure to modify
+ @param nChannels The number of expected channels on the description
+ @param interleaved A flag indicating whether the stereo samples should be interleaved in the buffer
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
+ numberOfChannels:(UInt32)nChannels
+ interleaved:(BOOL)interleaved __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - Math Utilities
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Math Utilities
+///-----------------------------------------------------------
+
+/**
+ Appends an array of values to a history buffer and performs an internal shift to add the values to the tail and removes the same number of values from the head.
+ @param buffer A float array of values to append to the tail of the history buffer
+ @param bufferLength The length of the float array being appended to the history buffer
+ @param scrollHistory The target history buffer in which to append the values
+ @param scrollHistoryLength The length of the target history buffer
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)appendBufferAndShift:(float*)buffer
+ withBufferSize:(int)bufferLength
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Appends a value to a history buffer and performs an internal shift to add the value to the tail and remove the 0th value.
+ @param value The float value to append to the history array
+ @param scrollHistory The target history buffer in which to append the values
+ @param scrollHistoryLength The length of the target history buffer
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++(void) appendValue:(float)value
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Maps a value from one coordinate system into another one. Takes in the current value to map, the minimum and maximum values of the first coordinate system, and the minimum and maximum values of the second coordinate system and calculates the mapped value in the second coordinate system's constraints.
+ @param value The value expressed in the first coordinate system
+ @param leftMin The minimum of the first coordinate system
+ @param leftMax The maximum of the first coordinate system
+ @param rightMin The minimum of the second coordindate system
+ @param rightMax The maximum of the second coordinate system
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return The mapped value in terms of the second coordinate system
+ */
++ (float)MAP:(float)value
+ leftMin:(float)leftMin
+ leftMax:(float)leftMax
+ rightMin:(float)rightMin
+ rightMax:(float)rightMax __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Calculates the root mean squared for a buffer.
+ @param buffer A float buffer array of values whose root mean squared to calculate
+ @param bufferSize The size of the float buffer
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return The root mean squared of the buffer
+ */
++ (float)RMS:(float*)buffer length:(int)bufferSize __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Calculate the sign function sgn(x) =
+ { -1 , x < 0,
+ { 0 , x = 0,
+ { 1 , x > 0
+ @param value The float value for which to use as x
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return The float sign value
+ */
++ (float)SGN:(float)value __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - OSStatus Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name OSStatus Utility
+///-----------------------------------------------------------
+
+/**
+ Basic check result function useful for checking each step of the audio setup process
+ @param result The OSStatus representing the result of an operation
+ @param operation A string (const char, not NSString) describing the operation taking place (will print if fails)
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)checkResult:(OSStatus)result operation:(const char *)operation __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a string representation of the often cryptic Core Audio error codes
+ @param code A UInt32 representing an error code
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ @return An NSString with a human readable version of the error code.
+ */
++ (NSString *)stringFromUInt32Code:(UInt32)code __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - Plot Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Plot Utility
+///-----------------------------------------------------------
+
+/**
+ Given a buffer representing a window of float history data this append the RMS of a buffer of incoming float data...This will likely be deprecated in a future version of EZAudio for a circular buffer based approach.
+ @param scrollHistory An array of float arrays being used to hold the history values for each channel.
+ @param scrollHistoryLength An int representing the length of the history window.
+ @param index An int pointer to the index of the current read index of the history buffer.
+ @param buffer A float array representing the incoming audio data.
+ @param bufferSize An int representing the length of the incoming audio data.
+ @param isChanging A BOOL pointer representing whether the resolution (length of the history window) is currently changing.
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)updateScrollHistory:(float **)scrollHistory
+ withLength:(int)scrollHistoryLength
+ atIndex:(int *)index
+ withBuffer:(float *)buffer
+ withBufferSize:(int)bufferSize
+ isResolutionChanging:(BOOL *)isChanging __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - TPCircularBuffer Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name TPCircularBuffer Utility
+///-----------------------------------------------------------
+
+/**
+ Appends the data from the audio buffer list to the circular buffer
+ @param circularBuffer Pointer to the instance of the TPCircularBuffer to add the audio data to
+ @param audioBufferList Pointer to the instance of the AudioBufferList with the audio data
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)appendDataToCircularBuffer:(TPCircularBuffer*)circularBuffer
+ fromAudioBufferList:(AudioBufferList*)audioBufferList __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the circular buffer (just a wrapper around the C method)
+ @param circularBuffer Pointer to an instance of the TPCircularBuffer
+ @param size The length of the TPCircularBuffer (usually 1024)
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)circularBuffer:(TPCircularBuffer*)circularBuffer
+ withSize:(int)size __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Frees a circular buffer
+ @param circularBuffer Pointer to the circular buffer to clear
+ @deprecated This method is deprecated starting in version 0.1.0.
+ @note Please use same method in EZAudioUtilities class instead.
+ */
++ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudio.m
+// EZAudioCoreGraphicsWaveformExample
+//
+// Created by Syed Haris Ali on 5/13/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+
+#import "EZAudio.h"
+
+@implementation EZAudio
+
+//------------------------------------------------------------------------------
+#pragma mark - Debugging
+//------------------------------------------------------------------------------
+
++ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail
+{
+ [EZAudioUtilities setShouldExitOnCheckResultFail:shouldExitOnCheckResultFail];
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)shouldExitOnCheckResultFail
+{
+ return [EZAudioUtilities shouldExitOnCheckResultFail];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioBufferList Utility
+//------------------------------------------------------------------------------
+
++ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+ interleaved:(BOOL)interleaved
+{
+ return [EZAudioUtilities audioBufferListWithNumberOfFrames:frames
+ numberOfChannels:channels
+ interleaved:interleaved];
+}
+
+//------------------------------------------------------------------------------
+
++ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+{
+ return [EZAudioUtilities floatBuffersWithNumberOfFrames:frames
+ numberOfChannels:channels];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeBufferList:(AudioBufferList *)bufferList
+{
+ [EZAudioUtilities freeBufferList:bufferList];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels
+{
+ [EZAudioUtilities freeFloatBuffers:buffers numberOfChannels:channels];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioStreamBasicDescription Utility
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities AIFFFormatWithNumberOfChannels:channels
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities iLBCFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities floatFormatWithNumberOfChannels:channels
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities M4AFormatWithNumberOfChannels:channels
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities monoFloatFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities monoCanonicalFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities stereoCanonicalNonInterleavedFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities stereoFloatInterleavedFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd
+{
+ return [EZAudioUtilities isFloatFormat:asbd];
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd
+{
+ return [EZAudioUtilities isInterleaved:asbd];
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd
+{
+ return [EZAudioUtilities isLinearPCM:asbd];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)printASBD:(AudioStreamBasicDescription)asbd
+{
+ [EZAudioUtilities printASBD:asbd];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds
+{
+ return [EZAudioUtilities displayTimeStringFromSeconds:seconds];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd
+{
+ return [EZAudioUtilities stringForAudioStreamBasicDescription:asbd];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
+ numberOfChannels:(UInt32)nChannels
+ interleaved:(BOOL)interleaved
+{
+ [EZAudioUtilities setCanonicalAudioStreamBasicDescription:asbd
+ numberOfChannels:nChannels
+ interleaved:interleaved];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Math Utilities
+//------------------------------------------------------------------------------
+
++ (void)appendBufferAndShift:(float*)buffer
+ withBufferSize:(int)bufferLength
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength
+{
+ [EZAudioUtilities appendBufferAndShift:buffer
+ withBufferSize:bufferLength
+ toScrollHistory:scrollHistory
+ withScrollHistorySize:scrollHistoryLength];
+}
+
+//------------------------------------------------------------------------------
+
++ (void) appendValue:(float)value
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength
+{
+ [EZAudioUtilities appendValue:value
+ toScrollHistory:scrollHistory
+ withScrollHistorySize:scrollHistoryLength];
+}
+
+//------------------------------------------------------------------------------
+
++ (float)MAP:(float)value
+ leftMin:(float)leftMin
+ leftMax:(float)leftMax
+ rightMin:(float)rightMin
+ rightMax:(float)rightMax
+{
+ return [EZAudioUtilities MAP:value
+ leftMin:leftMin
+ leftMax:leftMax
+ rightMin:rightMin
+ rightMax:rightMax];
+}
+
+//------------------------------------------------------------------------------
+
++ (float)RMS:(float *)buffer length:(int)bufferSize
+{
+ return [EZAudioUtilities RMS:buffer length:bufferSize];
+}
+
+//------------------------------------------------------------------------------
+
++ (float)SGN:(float)value
+{
+ return [EZAudioUtilities SGN:value];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - OSStatus Utility
+//------------------------------------------------------------------------------
+
++ (void)checkResult:(OSStatus)result operation:(const char *)operation
+{
+ [EZAudioUtilities checkResult:result
+ operation:operation];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)stringFromUInt32Code:(UInt32)code
+{
+ return [EZAudioUtilities stringFromUInt32Code:code];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Plot Utility
+//------------------------------------------------------------------------------
+
++ (void)updateScrollHistory:(float **)scrollHistory
+ withLength:(int)scrollHistoryLength
+ atIndex:(int *)index
+ withBuffer:(float *)buffer
+ withBufferSize:(int)bufferSize
+ isResolutionChanging:(BOOL *)isChanging
+{
+ [EZAudioUtilities updateScrollHistory:scrollHistory
+ withLength:scrollHistoryLength
+ atIndex:index
+ withBuffer:buffer
+ withBufferSize:bufferSize
+ isResolutionChanging:isChanging];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - TPCircularBuffer Utility
+//------------------------------------------------------------------------------
+
++ (void)appendDataToCircularBuffer:(TPCircularBuffer *)circularBuffer
+ fromAudioBufferList:(AudioBufferList *)audioBufferList
+{
+ [EZAudioUtilities appendDataToCircularBuffer:circularBuffer
+ fromAudioBufferList:audioBufferList];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size
+{
+ [EZAudioUtilities circularBuffer:circularBuffer withSize:size];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer
+{
+ [EZAudioUtilities freeCircularBuffer:circularBuffer];
+}
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioDevice.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/25/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+
+#if TARGET_OS_IPHONE
+#import <AVFoundation/AVFoundation.h>
+#elif TARGET_OS_MAC
+#endif
+
+/**
+ The EZAudioDevice provides an interface for getting the available input and output hardware devices on iOS and OSX. On iOS the EZAudioDevice uses the available devices found from the AVAudioSession, while on OSX the EZAudioDevice wraps the AudioHardware API to find any devices that are connected including the built-in devices (for instance, Built-In Microphone, Display Audio). Since the AVAudioSession and AudioHardware APIs are quite different the EZAudioDevice has different properties available on each platform. The EZMicrophone now supports setting any specific EZAudioDevice from the `inputDevices` function.
+ */
+@interface EZAudioDevice : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
+//------------------------------------------------------------------------------
+// @name Getting The Devices
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current EZAudioDevice that is being used to pull input.
+ @return An EZAudioDevice instance representing the currently selected input device.
+ */
++ (EZAudioDevice *)currentInputDevice;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current EZAudioDevice that is being used to output audio.
+ @return An EZAudioDevice instance representing the currently selected ouotput device.
+ */
++ (EZAudioDevice *)currentOutputDevice;
+
+//------------------------------------------------------------------------------
+
+/**
+ Enumerates all the available input devices and returns the result in an NSArray of EZAudioDevice instances.
+ @return An NSArray containing EZAudioDevice instances, one for each available input device.
+ */
++ (NSArray *)inputDevices;
+
+//------------------------------------------------------------------------------
+
+/**
+ Enumerates all the available output devices and returns the result in an NSArray of EZAudioDevice instances.
+ @return An NSArray of output EZAudioDevice instances.
+ */
++ (NSArray *)outputDevices;
+
+#if TARGET_OS_IPHONE
+
+//------------------------------------------------------------------------------
+
+/**
+ Enumerates all the available input devices.
+ - iOS only
+ @param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
+ */
++ (void)enumerateInputDevicesUsingBlock:(void(^)(EZAudioDevice *device,
+ BOOL *stop))block;
+
+//------------------------------------------------------------------------------
+
+/**
+ Enumerates all the available output devices.
+ - iOS only
+ @param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
+ */
++ (void)enumerateOutputDevicesUsingBlock:(void (^)(EZAudioDevice *device,
+ BOOL *stop))block;
+
+#elif TARGET_OS_MAC
+
+/**
+ Enumerates all the available devices and returns the result in an NSArray of EZAudioDevice instances.
+ - OSX only
+ @return An NSArray of input and output EZAudioDevice instances.
+ */
++ (NSArray *)devices;
+
+//------------------------------------------------------------------------------
+
+/**
+ Enumerates all the available devices.
+ - OSX only
+ @param block When enumerating this block executes repeatedly for each EZAudioDevice found. It contains two arguments - first, the EZAudioDevice found, then a pointer to a stop BOOL to allow breaking out of the enumeration)
+ */
++ (void)enumerateDevicesUsingBlock:(void(^)(EZAudioDevice *device,
+ BOOL *stop))block;
+
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+/**
+ An NSString representing a human-reable version of the device.
+ */
+@property (nonatomic, copy, readonly) NSString *name;
+
+#if TARGET_OS_IPHONE
+
+/**
+ An AVAudioSessionPortDescription describing an input or output hardware port.
+ - iOS only
+ */
+@property (nonatomic, strong, readonly) AVAudioSessionPortDescription *port;
+
+//------------------------------------------------------------------------------
+
+/**
+ An AVAudioSessionDataSourceDescription describing a specific data source for the `port` provided.
+ - iOS only
+ */
+@property (nonatomic, strong, readonly) AVAudioSessionDataSourceDescription *dataSource;
+
+#elif TARGET_OS_MAC
+
+/**
+ An AudioDeviceID representing the device in the AudioHardware API.
+ - OSX only
+ */
+@property (nonatomic, assign, readonly) AudioDeviceID deviceID;
+
+//------------------------------------------------------------------------------
+
+/**
+ An NSString representing the name of the manufacturer of the device.
+ - OSX only
+ */
+@property (nonatomic, copy, readonly) NSString *manufacturer;
+
+//------------------------------------------------------------------------------
+
+/**
+ An NSInteger representing the number of input channels available.
+ - OSX only
+ */
+@property (nonatomic, assign, readonly) NSInteger inputChannelCount;
+
+//------------------------------------------------------------------------------
+
+/**
+ An NSInteger representing the number of output channels available.
+ - OSX only
+ */
+@property (nonatomic, assign, readonly) NSInteger outputChannelCount;
+
+//------------------------------------------------------------------------------
+
+/**
+ An NSString representing the persistent identifier for the AudioDevice.
+ - OSX only
+ */
+@property (nonatomic, copy, readonly) NSString *UID;
+
+#endif
+
+@end
--- /dev/null
+//
+// EZAudioDevice.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/25/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioDevice.h"
+#import "EZAudioUtilities.h"
+
+@interface EZAudioDevice ()
+
+@property (nonatomic, copy, readwrite) NSString *name;
+
+#if TARGET_OS_IPHONE
+
+@property (nonatomic, strong, readwrite) AVAudioSessionPortDescription *port;
+@property (nonatomic, strong, readwrite) AVAudioSessionDataSourceDescription *dataSource;
+
+#elif TARGET_OS_MAC
+
+@property (nonatomic, assign, readwrite) AudioDeviceID deviceID;
+@property (nonatomic, copy, readwrite) NSString *manufacturer;
+@property (nonatomic, assign, readwrite) NSInteger inputChannelCount;
+@property (nonatomic, assign, readwrite) NSInteger outputChannelCount;
+@property (nonatomic, copy, readwrite) NSString *UID;
+
+#endif
+
+@end
+
+@implementation EZAudioDevice
+
+#if TARGET_OS_IPHONE
+
+//------------------------------------------------------------------------------
+
++ (EZAudioDevice *)currentInputDevice
+{
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ AVAudioSessionPortDescription *port = [[[session currentRoute] inputs] firstObject];
+ AVAudioSessionDataSourceDescription *dataSource = [session inputDataSource];
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = port;
+ device.dataSource = dataSource;
+ return device;
+}
+
+//------------------------------------------------------------------------------
+
++ (EZAudioDevice *)currentOutputDevice
+{
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ AVAudioSessionPortDescription *port = [[[session currentRoute] outputs] firstObject];
+ AVAudioSessionDataSourceDescription *dataSource = [session outputDataSource];
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = port;
+ device.dataSource = dataSource;
+ return device;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)inputDevices
+{
+ __block NSMutableArray *devices = [NSMutableArray array];
+ [self enumerateInputDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
+ {
+ [devices addObject:device];
+ }];
+ return devices;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)outputDevices
+{
+ __block NSMutableArray *devices = [NSMutableArray array];
+ [self enumerateOutputDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
+ {
+ [devices addObject:device];
+ }];
+ return devices;
+}
+
+//------------------------------------------------------------------------------
+
++ (void)enumerateInputDevicesUsingBlock:(void (^)(EZAudioDevice *, BOOL *))block
+{
+ if (!block)
+ {
+ return;
+ }
+
+ NSArray *inputs = [[AVAudioSession sharedInstance] availableInputs];
+ if (inputs == nil)
+ {
+ NSLog(@"Audio session is not active! In order to enumerate the audio devices you must set the category and set active the audio session for your iOS app before calling this function.");
+ return;
+ }
+
+ BOOL stop;
+ for (AVAudioSessionPortDescription *inputDevicePortDescription in inputs)
+ {
+ // add any additional sub-devices
+ NSArray *dataSources = [inputDevicePortDescription dataSources];
+ if (dataSources.count)
+ {
+ for (AVAudioSessionDataSourceDescription *inputDeviceDataSourceDescription in dataSources)
+ {
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = inputDevicePortDescription;
+ device.dataSource = inputDeviceDataSourceDescription;
+ block(device, &stop);
+ }
+ }
+ else
+ {
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = inputDevicePortDescription;
+ block(device, &stop);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
++ (void)enumerateOutputDevicesUsingBlock:(void (^)(EZAudioDevice *, BOOL *))block
+{
+ if (!block)
+ {
+ return;
+ }
+
+ AVAudioSessionRouteDescription *currentRoute = [[AVAudioSession sharedInstance] currentRoute];
+ NSArray *portDescriptions = [currentRoute outputs];
+
+ BOOL stop;
+ for (AVAudioSessionPortDescription *outputDevicePortDescription in portDescriptions)
+ {
+ // add any additional sub-devices
+ NSArray *dataSources = [outputDevicePortDescription dataSources];
+ if (dataSources.count)
+ {
+ for (AVAudioSessionDataSourceDescription *outputDeviceDataSourceDescription in dataSources)
+ {
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = outputDevicePortDescription;
+ device.dataSource = outputDeviceDataSourceDescription;
+ block(device, &stop);
+ }
+ }
+ else
+ {
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.port = outputDevicePortDescription;
+ block(device, &stop);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)name
+{
+ NSMutableString *name = [NSMutableString string];
+ if (self.port)
+ {
+ [name appendString:self.port.portName];
+ }
+ if (self.dataSource)
+ {
+ [name appendFormat:@": %@", self.dataSource.dataSourceName];
+ }
+ return name;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"%@ { port: %@, data source: %@ }",
+ [super description],
+ self.port,
+ self.dataSource];
+}
+
+//------------------------------------------------------------------------------
+
+- (BOOL)isEqual:(id)object
+{
+ if ([object isKindOfClass:self.class])
+ {
+ EZAudioDevice *device = (EZAudioDevice *)object;
+ BOOL isPortUIDEqual = [device.port.UID isEqualToString:self.port.UID];
+ BOOL isDataSourceIDEqual = device.dataSource.dataSourceID.longValue == self.dataSource.dataSourceID.longValue;
+ return isPortUIDEqual && isDataSourceIDEqual;
+ }
+ else
+ {
+ return [super isEqual:object];
+ }
+}
+
+#elif TARGET_OS_MAC
+
++ (void)enumerateDevicesUsingBlock:(void(^)(EZAudioDevice *device,
+ BOOL *stop))block
+{
+ if (!block)
+ {
+ return;
+ }
+
+ // get the present system devices
+ AudioObjectPropertyAddress address = [self addressForPropertySelector:kAudioHardwarePropertyDevices];
+ UInt32 devicesDataSize;
+ [EZAudioUtilities checkResult:AudioObjectGetPropertyDataSize(kAudioObjectSystemObject,
+ &address,
+ 0,
+ NULL,
+ &devicesDataSize)
+ operation:"Failed to get data size"];
+
+ // enumerate devices
+ NSInteger count = devicesDataSize / sizeof(AudioDeviceID);
+ AudioDeviceID *deviceIDs = (AudioDeviceID *)malloc(devicesDataSize);
+
+ // fill in the devices
+ [EZAudioUtilities checkResult:AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &address,
+ 0,
+ NULL,
+ &devicesDataSize,
+ deviceIDs)
+ operation:"Failed to get device IDs for available devices on OSX"];
+
+ BOOL stop = NO;
+ for (UInt32 i = 0; i < count; i++)
+ {
+ AudioDeviceID deviceID = deviceIDs[i];
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.deviceID = deviceID;
+ device.manufacturer = [self manufacturerForDeviceID:deviceID];
+ device.name = [self namePropertyForDeviceID:deviceID];
+ device.UID = [self UIDPropertyForDeviceID:deviceID];
+ device.inputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeInput forDeviceID:deviceID];
+ device.outputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeOutput forDeviceID:deviceID];
+ block(device, &stop);
+ if (stop)
+ {
+ break;
+ }
+ }
+
+ free(deviceIDs);
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)devices
+{
+ __block NSMutableArray *devices = [NSMutableArray array];
+ [self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
+ {
+ [devices addObject:device];
+ }];
+ return devices;
+}
+
+//------------------------------------------------------------------------------
+
++ (EZAudioDevice *)deviceWithPropertySelector:(AudioObjectPropertySelector)propertySelector
+{
+ AudioDeviceID deviceID;
+ UInt32 propSize = sizeof(AudioDeviceID);
+ AudioObjectPropertyAddress address = [self addressForPropertySelector:propertySelector];
+ [EZAudioUtilities checkResult:AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &address,
+ 0,
+ NULL,
+ &propSize,
+ &deviceID)
+ operation:"Failed to get device device on OSX"];
+ EZAudioDevice *device = [[EZAudioDevice alloc] init];
+ device.deviceID = deviceID;
+ device.manufacturer = [self manufacturerForDeviceID:deviceID];
+ device.name = [self namePropertyForDeviceID:deviceID];
+ device.UID = [self UIDPropertyForDeviceID:deviceID];
+ device.inputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeInput forDeviceID:deviceID];
+ device.outputChannelCount = [self channelCountForScope:kAudioObjectPropertyScopeOutput forDeviceID:deviceID];
+ return device;
+}
+
+//------------------------------------------------------------------------------
+
++ (EZAudioDevice *)currentInputDevice
+{
+ return [self deviceWithPropertySelector:kAudioHardwarePropertyDefaultInputDevice];
+}
+
+//------------------------------------------------------------------------------
+
++ (EZAudioDevice *)currentOutputDevice
+{
+ return [self deviceWithPropertySelector:kAudioHardwarePropertyDefaultOutputDevice];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)inputDevices
+{
+ __block NSMutableArray *devices = [NSMutableArray array];
+ [self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
+ {
+ if (device.inputChannelCount > 0)
+ {
+ [devices addObject:device];
+ }
+ }];
+ return devices;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)outputDevices
+{
+ __block NSMutableArray *devices = [NSMutableArray array];
+ [self enumerateDevicesUsingBlock:^(EZAudioDevice *device, BOOL *stop)
+ {
+ if (device.outputChannelCount > 0)
+ {
+ [devices addObject:device];
+ }
+ }];
+ return devices;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
++ (AudioObjectPropertyAddress)addressForPropertySelector:(AudioObjectPropertySelector)selector
+{
+ AudioObjectPropertyAddress address;
+ address.mScope = kAudioObjectPropertyScopeGlobal;
+ address.mElement = kAudioObjectPropertyElementMaster;
+ address.mSelector = selector;
+ return address;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)stringPropertyForSelector:(AudioObjectPropertySelector)selector
+ withDeviceID:(AudioDeviceID)deviceID
+{
+ AudioObjectPropertyAddress address = [self addressForPropertySelector:selector];
+ CFStringRef string;
+ UInt32 propSize = sizeof(CFStringRef);
+ NSString *errorString = [NSString stringWithFormat:@"Failed to get device property (%u)",(unsigned int)selector];
+ [EZAudioUtilities checkResult:AudioObjectGetPropertyData(deviceID,
+ &address,
+ 0,
+ NULL,
+ &propSize,
+ &string)
+ operation:errorString.UTF8String];
+ return (__bridge_transfer NSString *)string;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSInteger)channelCountForScope:(AudioObjectPropertyScope)scope
+ forDeviceID:(AudioDeviceID)deviceID
+{
+ AudioObjectPropertyAddress address;
+ address.mScope = scope;
+ address.mElement = kAudioObjectPropertyElementMaster;
+ address.mSelector = kAudioDevicePropertyStreamConfiguration;
+
+ AudioBufferList streamConfiguration;
+ UInt32 propSize = sizeof(streamConfiguration);
+ [EZAudioUtilities checkResult:AudioObjectGetPropertyData(deviceID,
+ &address,
+ 0,
+ NULL,
+ &propSize,
+ &streamConfiguration)
+ operation:"Failed to get frame size"];
+
+ NSInteger channelCount = 0;
+ for (NSInteger i = 0; i < streamConfiguration.mNumberBuffers; i++)
+ {
+ channelCount += streamConfiguration.mBuffers[i].mNumberChannels;
+ }
+
+ return channelCount;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)manufacturerForDeviceID:(AudioDeviceID)deviceID
+{
+ return [self stringPropertyForSelector:kAudioDevicePropertyDeviceManufacturerCFString
+ withDeviceID:deviceID];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)namePropertyForDeviceID:(AudioDeviceID)deviceID
+{
+ return [self stringPropertyForSelector:kAudioDevicePropertyDeviceNameCFString
+ withDeviceID:deviceID];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)UIDPropertyForDeviceID:(AudioDeviceID)deviceID
+{
+ return [self stringPropertyForSelector:kAudioDevicePropertyDeviceUID
+ withDeviceID:deviceID];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"%@ { deviceID: %i, manufacturer: %@, name: %@, UID: %@, inputChannelCount: %ld, outputChannelCount: %ld }",
+ [super description],
+ self.deviceID,
+ self.manufacturer,
+ self.name,
+ self.UID,
+ self.inputChannelCount,
+ self.outputChannelCount];
+}
+
+//------------------------------------------------------------------------------
+
+- (BOOL)isEqual:(id)object
+{
+ if ([object isKindOfClass:self.class])
+ {
+ EZAudioDevice *device = (EZAudioDevice *)object;
+ return [self.UID isEqualToString:device.UID];
+ }
+ else
+ {
+ return [super isEqual:object];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+#endif
+
+@end
--- /dev/null
+//
+// EZAudioDisplayLink.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/25/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <QuartzCore/QuartzCore.h>
+
+@class EZAudioDisplayLink;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLinkDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioDisplayLinkDelegate provides a means for an EZAudioDisplayLink instance to notify a receiver when it should redraw itself.
+ */
+@protocol EZAudioDisplayLinkDelegate <NSObject>
+
+@required
+/**
+ Required method for an EZAudioDisplayLinkDelegate to implement. This fires at the screen's display rate (typically 60 fps).
+ @param displayLink An EZAudioDisplayLink instance used by a receiver to draw itself at the screen's refresh rate.
+ */
+- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLink
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioDisplayLink provides a cross-platform (iOS and Mac) abstraction over the CADisplayLink for iOS and CVDisplayLink for Mac. The purpose of this class is to provide an accurate timer for views that need to redraw themselves at 60 fps. This class is used by the EZAudioPlot and, eventually, the EZAudioPlotGL to provide a timer mechanism to draw real-time plots.
+ */
+@interface EZAudioDisplayLink : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
+/**
+ Class method to create an EZAudioDisplayLink. The caller should implement the EZAudioDisplayLinkDelegate protocol to receive the `displayLinkNeedsDisplay:` delegate method to know when to redraw itself.
+ @param delegate An instance that implements the EZAudioDisplayLinkDelegate protocol.
+ @return An instance of the EZAudioDisplayLink.
+ */
++ (instancetype)displayLinkWithDelegate:(id<EZAudioDisplayLinkDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioDisplayLinkDelegate for which to receive the redraw calls.
+ */
+@property (nonatomic, weak) id<EZAudioDisplayLinkDelegate> delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Instance Methods
+//------------------------------------------------------------------------------
+
+/**
+ Method to start the display link and provide the `displayLinkNeedsDisplay:` calls to the `delegate`
+ */
+- (void)start;
+
+/**
+ Method to stop the display link from providing the `displayLinkNeedsDisplay:` calls to the `delegate`
+ */
+- (void)stop;
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioDisplayLink.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/25/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioDisplayLink.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - CVDisplayLink Callback (Declaration)
+//------------------------------------------------------------------------------
+
+#if TARGET_OS_IPHONE
+#elif TARGET_OS_MAC
+static CVReturn EZAudioDisplayLinkCallback(CVDisplayLinkRef displayLinkRef,
+ const CVTimeStamp *now,
+ const CVTimeStamp *outputTime,
+ CVOptionFlags flagsIn,
+ CVOptionFlags *flagsOut,
+ void *displayLinkContext);
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLink (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZAudioDisplayLink ()
+#if TARGET_OS_IPHONE
+@property (nonatomic, strong) CADisplayLink *displayLink;
+#elif TARGET_OS_MAC
+@property (nonatomic, assign) CVDisplayLinkRef displayLink;
+#endif
+@property (nonatomic, assign) BOOL stopped;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLink (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioDisplayLink
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+#if TARGET_OS_IPHONE
+ [self.displayLink invalidate];
+#elif TARGET_OS_MAC
+ CVDisplayLinkStop(self.displayLink);
+ CVDisplayLinkRelease(self.displayLink);
+ self.displayLink = nil;
+#endif
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initialization
+//------------------------------------------------------------------------------
+
++ (instancetype)displayLinkWithDelegate:(id<EZAudioDisplayLinkDelegate>)delegate
+{
+ EZAudioDisplayLink *displayLink = [[self alloc] init];
+ displayLink.delegate = delegate;
+ return displayLink;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype) init
+{
+ self = [super init];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ self.stopped = YES;
+#if TARGET_OS_IPHONE
+ self.displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update)];
+ [self.displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
+#elif TARGET_OS_MAC
+ CVDisplayLinkCreateWithActiveCGDisplays(&_displayLink);
+ CVDisplayLinkSetOutputCallback(self.displayLink,
+ EZAudioDisplayLinkCallback,
+ (__bridge void *)(self));
+ CVDisplayLinkStart(self.displayLink);
+#endif
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)start
+{
+#if TARGET_OS_IPHONE
+ self.displayLink.paused = NO;
+#elif TARGET_OS_MAC
+ CVDisplayLinkStart(self.displayLink);
+#endif
+ self.stopped = NO;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)stop
+{
+#if TARGET_OS_IPHONE
+ self.displayLink.paused = YES;
+#elif TARGET_OS_MAC
+ CVDisplayLinkStop(self.displayLink);
+#endif
+ self.stopped = YES;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)update
+{
+ if (!self.stopped)
+ {
+ if ([self.delegate respondsToSelector:@selector(displayLinkNeedsDisplay:)])
+ {
+ [self.delegate displayLinkNeedsDisplay:self];
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - CVDisplayLink Callback (Implementation)
+//------------------------------------------------------------------------------
+
+#if TARGET_OS_IPHONE
+#elif TARGET_OS_MAC
+static CVReturn EZAudioDisplayLinkCallback(CVDisplayLinkRef displayLinkRef,
+ const CVTimeStamp *now,
+ const CVTimeStamp *outputTime,
+ CVOptionFlags flagsIn,
+ CVOptionFlags *flagsOut,
+ void *displayLinkContext)
+{
+ EZAudioDisplayLink *displayLink = (__bridge EZAudioDisplayLink*)displayLinkContext;
+ [displayLink update];
+ return kCVReturnSuccess;
+}
+#endif
\ No newline at end of file
--- /dev/null
+//
+// EZAudioFFT.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 7/10/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <Accelerate/Accelerate.h>
+
+@class EZAudioFFT;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFTDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioFFTDelegate provides event callbacks for the EZAudioFFT (and subclasses such as the EZAudioFFTRolling) whenvever the FFT is computed.
+ */
+@protocol EZAudioFFTDelegate <NSObject>
+
+@optional
+
+///-----------------------------------------------------------
+/// @name Getting FFT Output Data
+///-----------------------------------------------------------
+
+/**
+ Triggered when the EZAudioFFT computes an FFT from a buffer of input data. Provides an array of float data representing the computed FFT.
+ @param fft The EZAudioFFT instance that triggered the event.
+ @param fftData A float pointer representing the float array of FFT data.
+ @param bufferSize A vDSP_Length (unsigned long) representing the length of the float array.
+ */
+- (void) fft:(EZAudioFFT *)fft
+ updatedWithFFTData:(float *)fftData
+ bufferSize:(vDSP_Length)bufferSize;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFT
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioFFT provides a base class to quickly calculate the FFT of incoming audio data using the Accelerate framework. In addition, the EZAudioFFT contains an EZAudioFFTDelegate to receive an event anytime an FFT is computed.
+ */
+@interface EZAudioFFT : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFT (or subclass) instance with a maximum buffer size and sample rate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0.
+ @param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
+ @param sampleRate A float representing the sample rate of the incoming audio data.
+
+ @return A newly created EZAudioFFT (or subclass) instance.
+ */
+- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFT (or subclass) instance with a maximum buffer size, sample rate, and EZAudioFFTDelegate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0. The EZAudioFFTDelegate will act as a receive to get an event whenever the FFT is calculated.
+ @param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
+ @param sampleRate A float representing the sample rate of the incoming audio data.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFT (or subclass) instance.
+ */
+- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFT (or subclass) instance with a maximum buffer size and sample rate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0.
+ @param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
+ @param sampleRate A float representing the sample rate of the incoming audio data.
+ @return A newly created EZAudioFFT (or subclass) instance.
+ */
++ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFT (or subclass) instance with a maximum buffer size, sample rate, and EZAudioFFTDelegate. The sample rate is used specifically to calculate the `maxFrequency` property. If you don't care about the `maxFrequency` property then you can set the sample rate to 0. The EZAudioFFTDelegate will act as a receive to get an event whenever the FFT is calculated.
+ @param maximumBufferSize A vDSP_Length (unsigned long) representing the maximum length of the incoming audio data.
+ @param sampleRate A float representing the sample rate of the incoming audio data.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFT (or subclass) instance.
+ */
++ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Properties
+///-----------------------------------------------------------
+
+/**
+ An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ */
+@property (weak, nonatomic) id<EZAudioFFTDelegate> delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ A COMPLEX_SPLIT data structure used to hold the FFT's imaginary and real components.
+ */
+@property (readonly, nonatomic) COMPLEX_SPLIT complexSplit;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float array containing the last calculated FFT data.
+ */
+@property (readonly, nonatomic) float *fftData;
+
+//------------------------------------------------------------------------------
+
+/**
+ An FFTSetup data structure used to internally calculate the FFT using Accelerate.
+ */
+@property (readonly, nonatomic) FFTSetup fftSetup;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float array containing the last calculated inverse FFT data (the time domain signal).
+ */
+@property (readonly, nonatomic) float *inversedFFTData;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float representing the frequency with the highest energy is the last FFT calculation.
+ */
+@property (readonly, nonatomic) float maxFrequency;
+
+//------------------------------------------------------------------------------
+
+/**
+ A vDSP_Length (unsigned long) representing the index of the frequency with the highest energy is the last FFT calculation.
+ */
+@property (readonly, nonatomic) vDSP_Length maxFrequencyIndex;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float representing the magnitude of the frequency with the highest energy is the last FFT calculation.
+ */
+@property (readonly, nonatomic) float maxFrequencyMagnitude;
+
+//------------------------------------------------------------------------------
+
+/**
+ A vDSP_Length (unsigned long) representing the maximum buffer size. This is the maximum length the incoming audio data in the `computeFFTWithBuffer:withBufferSize` method can be.
+ */
+@property (readonly, nonatomic) vDSP_Length maximumBufferSize;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float representing the sample rate of the incoming audio data.
+ */
+@property (readwrite, nonatomic) float sampleRate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Computing The FFT
+///-----------------------------------------------------------
+
+/**
+ Computes the FFT for a float array representing an incoming audio signal. This will trigger the EZAudioFFTDelegate method `fft:updatedWithFFTData:bufferSize:`.
+ @param buffer A float array representing the audio data.
+ @param bufferSize The length of the float array of audio data.
+ @return A float array containing the computed FFT data. The length of the output will be half the incoming buffer (half the `bufferSize` argument).
+ */
+- (float *)computeFFTWithBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the frequency corresponding to an index in the last computed FFT data.
+ @param index A vDSP_Length (unsigned integer) representing the index of the frequency bin value you'd like to get
+ @return A float representing the frequency value at that index.
+ */
+- (float)frequencyAtIndex:(vDSP_Length)index;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the magnitude of the frequenecy corresponding to an index in the last computed FFT data.
+ @param index A vDSP_Length (unsigned integer) representing the index of the frequency bin value you'd like to get
+ @return A float representing the frequency magnitude value at that index.
+ */
+- (float)frequencyMagnitudeAtIndex:(vDSP_Length)index;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFTRolling
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioFFTRolling, a subclass of EZAudioFFT, provides a class to calculate an FFT for an incoming audio signal while maintaining a history of audio data to allow much higher resolution FFTs. For instance, the EZMicrophone typically provides 512 frames at a time, but you would probably want to provide 2048 or 4096 frames for a decent looking FFT if you're trying to extract precise frequency components. You will typically be using this class for variable length FFTs instead of the EZAudioFFT base class.
+ */
+@interface EZAudioFFTRolling : EZAudioFFT
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property). The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @return A newly created EZAudioFFTRolling instance.
+ */
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFTRolling instance.
+ */
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property).
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @return A newly created EZAudioFFTRolling instance.
+ */
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFTRolling instance.
+ */
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFTRolling instance with a window size and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property). The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @return A newly created EZAudioFFTRolling instance.
+ */
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFTRolling instance with a window size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated. The history buffer size in this case is the `windowSize` * 8, which is pretty good for most cases.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFTRolling instance.
+ */
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, and a sample rate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, and a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property).
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @return A newly created EZAudioFFTRolling instance.
+ */
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to initialize an EZAudioFFTRolling instance with a window size, a history buffer size, a sample rate, and an EZAudioFFTDelegate. The EZAudioFFTRolling has an internal EZPlotHistoryInfo data structure that writes audio data to a circular buffer and manages sliding windows of audio data to support efficient, large FFT calculations. Here you provide a window size that represents how many audio sample will be used to calculate the FFT, a history buffer size representing the maximum length of the sliding window's underlying circular buffer, a float representing the sample rate of the incoming audio (can be 0 if you don't care about the `maxFrequency` property), and an EZAudioFFTDelegate to receive a callback anytime the FFT is calculated.
+ @param windowSize A vDSP_Length (unsigned long) representing the size of the window (i.e. the resolution) of data that should be used to calculate the FFT. A typical value for this would be something like 1024 - 4096 (or higher for an even higher resolution FFT).
+ @param historyBufferSize A vDSP_Length (unsigned long) representing the length of the history buffer. This should be AT LEAST the size of the window. A recommended value for this would be at least 8x greater than the `windowSize` argument.
+ @param sampleRate A float representing the sample rate of the incoming audio signal.
+ @param delegate An EZAudioFFTDelegate to receive an event whenever the FFT is calculated.
+ @return A newly created EZAudioFFTRolling instance.
+ */
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Properties
+///-----------------------------------------------------------
+
+/**
+ A vDSP_Length (unsigned long) representing the length of the FFT window.
+ */
+@property (readonly, nonatomic) vDSP_Length windowSize;
+
+//------------------------------------------------------------------------------
+
+/**
+ A float array representing the audio data in the internal circular buffer used to perform the FFT. This will increase as more data is appended to the internal circular buffer via the `computeFFTWithBuffer:withBufferSize:` method. The length of this array is the `timeDomainBufferSize` property.
+ */
+@property (readonly, nonatomic) float *timeDomainData;
+
+//------------------------------------------------------------------------------
+
+/**
+ A UInt32 representing the length of the audio data used to perform the FFT.
+ */
+@property (readonly, nonatomic) UInt32 timeDomainBufferSize;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioFFT.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 7/10/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioFFT.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct EZAudioFFTInfo
+{
+ FFTSetup fftSetup;
+ COMPLEX_SPLIT complexA;
+ float *outFFTData;
+ vDSP_Length outFFTDataLength;
+ float *inversedFFTData;
+ vDSP_Length maxFrequencyIndex;
+ float maxFrequencyMangitude;
+ float maxFrequency;
+} EZAudioFFTInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFT (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZAudioFFT ()
+@property (assign, nonatomic) EZAudioFFTInfo *info;
+@property (readwrite, nonatomic) vDSP_Length maximumBufferSize;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFT (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioFFT
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ vDSP_destroy_fftsetup(self.info->fftSetup);
+ free(self.info->complexA.realp);
+ free(self.info->complexA.imagp);
+ free(self.info->outFFTData);
+ free(self.info->inversedFFTData);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+{
+ return [self initWithMaximumBufferSize:maximumBufferSize
+ sampleRate:sampleRate
+ delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ self = [super init];
+ if (self)
+ {
+ self.maximumBufferSize = (vDSP_Length)maximumBufferSize;
+ self.sampleRate = sampleRate;
+ self.delegate = delegate;
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+{
+ return [[self alloc] initWithMaximumBufferSize:maximumBufferSize
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithMaximumBufferSize:(vDSP_Length)maximumBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ return [[self alloc] initWithMaximumBufferSize:maximumBufferSize
+ sampleRate:sampleRate
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ NSAssert(self.maximumBufferSize > 0, @"Expected FFT buffer size to be greater than 0!");
+
+ //
+ // Initialize FFT
+ //
+ float maximumBufferSizeBytes = self.maximumBufferSize * sizeof(float);
+ self.info = (EZAudioFFTInfo *)calloc(1, sizeof(EZAudioFFTInfo));
+ vDSP_Length log2n = log2f(self.maximumBufferSize);
+ self.info->fftSetup = vDSP_create_fftsetup(log2n, FFT_RADIX2);
+ long nOver2 = maximumBufferSizeBytes / 2;
+ size_t maximumSizePerComponentBytes = nOver2 * sizeof(float);
+ self.info->complexA.realp = (float *)malloc(maximumSizePerComponentBytes);
+ self.info->complexA.imagp = (float *)malloc(maximumSizePerComponentBytes);
+ self.info->outFFTData = (float *)malloc(maximumSizePerComponentBytes);
+ memset(self.info->outFFTData, 0, maximumSizePerComponentBytes);
+ self.info->inversedFFTData = (float *)malloc(maximumSizePerComponentBytes);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (float *)computeFFTWithBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
+{
+ if (buffer == NULL)
+ {
+ return NULL;
+ }
+
+ //
+ // Calculate real + imaginary components and normalize
+ //
+ vDSP_Length log2n = log2f(bufferSize);
+ long nOver2 = bufferSize / 2;
+ float mFFTNormFactor = 10.0 / (2 * bufferSize);
+ vDSP_ctoz((COMPLEX*)buffer, 2, &(self.info->complexA), 1, nOver2);
+ vDSP_fft_zrip(self.info->fftSetup, &(self.info->complexA), 1, log2n, FFT_FORWARD);
+ vDSP_vsmul(self.info->complexA.realp, 1, &mFFTNormFactor, self.info->complexA.realp, 1, nOver2);
+ vDSP_vsmul(self.info->complexA.imagp, 1, &mFFTNormFactor, self.info->complexA.imagp, 1, nOver2);
+ vDSP_zvmags(&(self.info->complexA), 1, self.info->outFFTData, 1, nOver2);
+ vDSP_fft_zrip(self.info->fftSetup, &(self.info->complexA), 1, log2n, FFT_INVERSE);
+ vDSP_ztoc(&(self.info->complexA), 1, (COMPLEX *) self.info->inversedFFTData , 2, nOver2);
+ self.info->outFFTDataLength = nOver2;
+
+ //
+ // Calculate max freq
+ //
+ if (self.sampleRate > 0.0f)
+ {
+ vDSP_maxvi(self.info->outFFTData, 1, &self.info->maxFrequencyMangitude, &self.info->maxFrequencyIndex, nOver2);
+ self.info->maxFrequency = [self frequencyAtIndex:self.info->maxFrequencyIndex];
+ }
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(fft:updatedWithFFTData:bufferSize:)])
+ {
+ [self.delegate fft:self
+ updatedWithFFTData:self.info->outFFTData
+ bufferSize:nOver2];
+ }
+
+ //
+ // Return the FFT
+ //
+ return self.info->outFFTData;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)frequencyAtIndex:(vDSP_Length)index
+{
+ if (!(self.info->outFFTData == NULL || self.sampleRate == 0.0f))
+ {
+ float nyquistMaxFreq = self.sampleRate / 2.0;
+ return ((float)index / (float)self.info->outFFTDataLength) * nyquistMaxFreq;
+ }
+ return NSNotFound;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)frequencyMagnitudeAtIndex:(vDSP_Length)index
+{
+ if (self.info->outFFTData != NULL)
+ {
+ return self.info->outFFTData[index];
+ }
+ return NSNotFound;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (COMPLEX_SPLIT)complexSplit
+{
+ return self.info->complexA;
+}
+
+//------------------------------------------------------------------------------
+
+- (float *)fftData
+{
+ return self.info->outFFTData;
+}
+
+//------------------------------------------------------------------------------
+
+- (FFTSetup)fftSetup
+{
+ return self.info->fftSetup;
+}
+
+//------------------------------------------------------------------------------
+
+- (float *)inversedFFTData
+{
+ return self.info->inversedFFTData;
+}
+
+//------------------------------------------------------------------------------
+
+- (vDSP_Length)maxFrequencyIndex
+{
+ return self.info->maxFrequencyIndex;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)maxFrequencyMagnitude
+{
+ return self.info->maxFrequencyMangitude;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)maxFrequency
+{
+ return self.info->maxFrequency;
+}
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFTRolling
+//------------------------------------------------------------------------------
+
+@interface EZAudioFFTRolling ()
+@property (assign, nonatomic) EZPlotHistoryInfo *historyInfo;
+@property (readwrite, nonatomic) vDSP_Length windowSize;
+
+@end
+
+@implementation EZAudioFFTRolling
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [EZAudioUtilities freeHistoryInfo:self.historyInfo];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+{
+ return [self initWithWindowSize:windowSize
+ historyBufferSize:windowSize * 8
+ sampleRate:sampleRate
+ delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ return [self initWithWindowSize:windowSize
+ historyBufferSize:windowSize * 8
+ sampleRate:sampleRate
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+{
+ return [self initWithWindowSize:windowSize
+ historyBufferSize:historyBufferSize
+ sampleRate:sampleRate
+ delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ self = [super initWithMaximumBufferSize:historyBufferSize
+ sampleRate:sampleRate];
+ if (self)
+ {
+ self.delegate = delegate;
+ self.windowSize = windowSize;
+
+ //
+ // Allocate an appropriately sized history buffer in bytes
+ //
+ self.historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:(UInt32)windowSize
+ maximumLength:(UInt32)historyBufferSize];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+{
+ return [[self alloc] initWithWindowSize:windowSize
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ return [[self alloc] initWithWindowSize:windowSize
+ sampleRate:sampleRate
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+{
+ return [[self alloc] initWithWindowSize:windowSize
+ historyBufferSize:historyBufferSize
+ sampleRate:sampleRate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)fftWithWindowSize:(vDSP_Length)windowSize
+ historyBufferSize:(vDSP_Length)historyBufferSize
+ sampleRate:(float)sampleRate
+ delegate:(id<EZAudioFFTDelegate>)delegate
+{
+ return [[self alloc] initWithWindowSize:windowSize
+ historyBufferSize:historyBufferSize
+ sampleRate:sampleRate
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (float *)computeFFTWithBuffer:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+{
+ if (buffer == NULL)
+ {
+ return NULL;
+ }
+
+ //
+ // Append buffer to history window
+ //
+ [EZAudioUtilities appendBuffer:buffer
+ withBufferSize:bufferSize
+ toHistoryInfo:self.historyInfo];
+
+ //
+ // Call super to calculate the FFT of the window
+ //
+ return [super computeFFTWithBuffer:self.historyInfo->buffer
+ withBufferSize:self.historyInfo->bufferSize];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (UInt32)timeDomainBufferSize
+{
+ return self.historyInfo->bufferSize;
+}
+
+//------------------------------------------------------------------------------
+
+- (float *)timeDomainData
+{
+ return self.historyInfo->buffer;
+}
+
+@end
--- /dev/null
+//
+// EZAudioFile.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+#import "EZAudioFloatData.h"
+
+//------------------------------------------------------------------------------
+
+@class EZAudio;
+@class EZAudioFile;
+
+//------------------------------------------------------------------------------
+#pragma mark - Blocks
+//------------------------------------------------------------------------------
+/**
+ A block used when returning back the waveform data. The waveform data itself will be an array of float arrays, one for each channel, and the length indicates the total length of each float array.
+ @param waveformData An array of float arrays, each representing a channel of audio data from the file
+ @param length An int representing the length of each channel of float audio data
+ */
+typedef void (^EZAudioWaveformDataCompletionBlock)(float **waveformData, int length);
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFileDelegate
+//------------------------------------------------------------------------------
+/**
+ The EZAudioFileDelegate provides event callbacks for the EZAudioFile object. These type of events are triggered by reads and seeks on the file and gives feedback such as the audio data read as a float array for visualizations and the new seek position for UI updating.
+ */
+@protocol EZAudioFileDelegate <NSObject>
+
+@optional
+/**
+ Triggered from the EZAudioFile function `readFrames:audioBufferList:bufferSize:eof:` to notify the delegate of the read audio data as a float array instead of a buffer list. Common use case of this would be to visualize the float data using an audio plot or audio data dependent OpenGL sketch.
+ @param audioFile The instance of the EZAudioFile that triggered the event.
+ @param buffer A float array of float arrays holding the audio data. buffer[0] would be the left channel's float array while buffer[1] would be the right channel's float array in a stereo file.
+ @param bufferSize The length of the buffers float arrays
+ @param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
+ */
+- (void) audioFile:(EZAudioFile *)audioFile
+ readAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels;
+
+//------------------------------------------------------------------------------
+
+/**
+ Occurs when the audio file's internal seek position has been updated by the EZAudioFile functions `readFrames:audioBufferList:bufferSize:eof:` or `audioFile:updatedPosition:`. As of 0.8.0 this is the preferred method of listening for position updates on the audio file since a user may want the pull the currentTime, formattedCurrentTime, or the frame index from the EZAudioFile instance provided.
+ @param audioFile The instance of the EZAudio in which the change occured.
+ */
+- (void)audioFileUpdatedPosition:(EZAudioFile *)audioFile;
+
+//------------------------------------------------------------------------------
+
+/**
+ Occurs when the audio file's internal seek position has been updated by the EZAudioFile functions `readFrames:audioBufferList:bufferSize:eof:` or `audioFile:updatedPosition:`.
+ @param audioFile The instance of the EZAudio in which the change occured
+ @param framePosition The new frame index as a 64-bit signed integer
+ @deprecated This property is deprecated starting in version 0.8.0.
+ @note Please use `audioFileUpdatedPosition:` property instead.
+ */
+- (void)audioFile:(EZAudioFile *)audioFile
+ updatedPosition:(SInt64)framePosition __attribute__((deprecated));
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFile
+//------------------------------------------------------------------------------
+/**
+ The EZAudioFile provides a lightweight and intuitive way to asynchronously interact with audio files. These interactions included reading audio data, seeking within an audio file, getting information about the file, and pulling the waveform data for visualizing the contents of the audio file. The EZAudioFileDelegate provides event callbacks for when reads, seeks, and various updates happen within the audio file to allow the caller to interact with the action in meaningful ways. Common use cases here could be to read the audio file's data as AudioBufferList structures for output (see EZOutput) and visualizing the audio file's data as a float array using an audio plot (see EZAudioPlot).
+ */
+@interface EZAudioFile : NSObject <NSCopying>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+/**
+ A EZAudioFileDelegate for the audio file that is used to return events such as new seek positions within the file and the read audio data as a float array.
+ */
+@property (nonatomic, weak) id<EZAudioFileDelegate> delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+/**
+ @name Initialization
+*/
+
+/**
+ Creates a new instance of the EZAudioFile using a file path URL.
+ @param url The file path reference of the audio file as an NSURL.
+ @return The newly created EZAudioFile instance. nil if the file path does not exist.
+ */
+- (instancetype)initWithURL:(NSURL *)url;
+
+/**
+ Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
+ @param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
+ @param url The file path reference of the audio file as an NSURL.
+ @return The newly created EZAudioFile instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
+ @param url The file path reference of the audio file as an NSURL.
+ @param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
+ @param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate format in its file format, but your app wants to read the samples at a sample rate of 44.1 kHz so it can iterate with other components (like a audio processing graph) without any weird playback effects. If this initializer is not used then a non-interleaved float format will be assumed.
+ @return The newly created EZAudioFile instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+ clientFormat:(AudioStreamBasicDescription)clientFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+/**
+ @name Class Initializers
+ */
+
+/**
+ Class method that creates a new instance of the EZAudioFile using a file path URL.
+ @param url The file path reference of the audio file as an NSURL.
+ @return The newly created EZAudioFile instance.
+ */
++ (instancetype)audioFileWithURL:(NSURL *)url;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol.
+ @param url The file path reference of the audio file as an NSURL.
+ @param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
+ @return The newly created EZAudioFile instance.
+ */
++ (instancetype)audioFileWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method that creates a new instance of the EZAudioFile using a file path URL with a delegate conforming to the EZAudioFileDelegate protocol and a client format.
+ @param url The file path reference of the audio file as an NSURL.
+ @param delegate The audio file delegate that receives events specified by the EZAudioFileDelegate protocol
+ @param clientFormat An AudioStreamBasicDescription that will be used as the client format on the audio file. For instance, the audio file might be in a 22.5 kHz sample rate, interleaved MP3 file format, but your app wants to read linear PCM samples at a sample rate of 44.1 kHz so it can be read in the context of other components sharing a common stream format (like a audio processing graph). If this initializer is not used then the `defaultClientFormat` will be used as teh default value for the client format.
+ @return The newly created EZAudioFile instance.
+ */
++ (instancetype)audioFileWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+ clientFormat:(AudioStreamBasicDescription)clientFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+/**
+ @name Class Methods
+ */
+
+/**
+ A class method that subclasses can override to specify the default client format that will be used to read audio data from this file. A client format is different from the file format in that it is the format of the other components interacting with this file. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
+ @return An AudioStreamBasicDescription that serves as the audio file's client format.
+ */
++ (AudioStreamBasicDescription)defaultClientFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ A class method that subclasses can override to specify the default sample rate that will be used in the `defaultClientFormat` method. Default is 44100.0 (44.1 kHz).
+ @return A Float64 representing the sample rate that should be used in the default client format.
+ */
++ (Float64)defaultClientFormatSampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides an array of the supported audio files types. Each audio file type is provided as a string, i.e. @"caf". Useful for filtering lists of files in an open panel to only the types allowed.
+ @return An array of NSString objects representing the represented file types.
+ */
++ (NSArray *)supportedAudioFileTypes;
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+/**
+ @name Reading From The Audio File
+ */
+
+/**
+ Reads a specified number of frames from the audio file. In addition, this will notify the EZAudioFileDelegate (if specified) of the read data as a float array with the audioFile:readAudio:withBufferSize:withNumberOfChannels: event and the new seek position within the file with the audioFile:updatedPosition: event.
+ @param frames The number of frames to read from the file.
+ @param audioBufferList An allocated AudioBufferList structure in which to store the read audio data
+ @param bufferSize A pointer to a UInt32 in which to store the read buffersize
+ @param eof A pointer to a BOOL in which to store whether the read operation reached the end of the audio file.
+ */
+- (void)readFrames:(UInt32)frames
+ audioBufferList:(AudioBufferList *)audioBufferList
+ bufferSize:(UInt32 *)bufferSize
+ eof:(BOOL *)eof;
+
+//------------------------------------------------------------------------------
+
+/**
+ @name Seeking Through The Audio File
+ */
+
+/**
+ Seeks through an audio file to a specified frame. This will notify the EZAudioFileDelegate (if specified) with the audioFile:updatedPosition: function.
+ @param frame The new frame position to seek to as a SInt64.
+ */
+- (void)seekToFrame:(SInt64)frame;
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+/**
+ @name Getting Information About The Audio File
+ */
+
+/**
+ Provides the common AudioStreamBasicDescription that will be used for in-app interaction. The file's format will be converted to this format and then sent back as either a float array or a `AudioBufferList` pointer. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the audio file to properly read samples from it with any interpolation or format conversion that must take place done automatically within the EZAudioFile `readFrames:audioBufferList:bufferSize:eof:` method. Default is stereo, non-interleaved, 44.1 kHz.
+ @warning This must be a linear PCM format!
+ @return An AudioStreamBasicDescription structure describing the format of the audio file.
+ */
+@property (readwrite) AudioStreamBasicDescription clientFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
+ @warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
+ */
+@property (nonatomic, readwrite) NSTimeInterval currentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration of the audio file in seconds.
+ */
+@property (readonly) NSTimeInterval duration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the AudioStreamBasicDescription structure containing the format of the file.
+ @return An AudioStreamBasicDescription structure describing the format of the audio file.
+ */
+@property (readonly) AudioStreamBasicDescription fileFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current time as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedCurrentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedDuration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the frame index (a.k.a the seek positon) within the audio file as SInt64. This can be helpful when seeking through the audio file.
+ @return The current frame index within the audio file as a SInt64.
+ */
+@property (readonly) SInt64 frameIndex;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a dictionary containing the metadata (ID3) tags that are included in the header for the audio file. Typically this contains stuff like artist, title, release year, etc.
+ @return An NSDictionary containing the metadata for the audio file.
+ */
+@property (readonly) NSDictionary *metadata;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the total duration of the audio file in seconds.
+ @deprecated This property is deprecated starting in version 0.3.0.
+ @note Please use `duration` property instead.
+ @return The total duration of the audio file as a Float32.
+ */
+@property (readonly) NSTimeInterval totalDuration __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the total frame count of the audio file in the client format.
+ @return The total number of frames in the audio file in the AudioStreamBasicDescription representing the client format as a SInt64.
+ */
+@property (readonly) SInt64 totalClientFrames;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the total frame count of the audio file in the file format.
+ @return The total number of frames in the audio file in the AudioStreamBasicDescription representing the file format as a SInt64.
+ */
+@property (readonly) SInt64 totalFrames;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the NSURL for the audio file.
+ @return An NSURL representing the path of the EZAudioFile instance.
+ */
+@property (nonatomic, copy, readonly) NSURL *url;
+
+//------------------------------------------------------------------------------
+#pragma mark - Helpers
+//------------------------------------------------------------------------------
+
+/**
+ Synchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
+ @param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
+ @return A EZAudioFloatData instance containing the audio data for all channels of the audio.
+ */
+- (EZAudioFloatData *)getWaveformData;
+
+//------------------------------------------------------------------------------
+
+/**
+ Synchronously pulls the waveform amplitude data into a float array for the receiver.
+ @param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
+ @return A EZAudioFloatData instance containing the audio data for all channels of the audio.
+ */
+- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints;
+
+//------------------------------------------------------------------------------
+
+/**
+ Asynchronously pulls the waveform amplitude data into a float array for the receiver. This returns a waveform with a default resolution of 1024, meaning there are 1024 data points to plot the waveform.
+ @param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
+ */
+- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)completion;
+
+//------------------------------------------------------------------------------
+
+/**
+ Asynchronously pulls the waveform amplitude data into a float array for the receiver.
+ @param numberOfPoints A UInt32 representing the number of data points you need. The higher the number of points the more detailed the waveform will be.
+ @param completion A EZAudioWaveformDataCompletionBlock that executes when the waveform data has been extracted. Provides a `EZAudioFloatData` instance containing the waveform data for all audio channels.
+ */
+- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
+ completion:(EZAudioWaveformDataCompletionBlock)completion;
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioFile.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioFile.h"
+
+//------------------------------------------------------------------------------
+
+#import "EZAudio.h"
+#import "EZAudioFloatConverter.h"
+#import "EZAudioFloatData.h"
+#include <pthread.h>
+
+// constants
+static UInt32 EZAudioFileWaveformDefaultResolution = 1024;
+static NSString *EZAudioFileWaveformDataQueueIdentifier = @"com.ezaudio.waveformQueue";
+
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ AudioFileID audioFileID;
+ AudioStreamBasicDescription clientFormat;
+ NSTimeInterval duration;
+ ExtAudioFileRef extAudioFileRef;
+ AudioStreamBasicDescription fileFormat;
+ SInt64 frames;
+ CFURLRef sourceURL;
+} EZAudioFileInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFile
+//------------------------------------------------------------------------------
+
+@interface EZAudioFile ()
+@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
+@property (nonatomic) float **floatData;
+@property (nonatomic) EZAudioFileInfo *info;
+@property (nonatomic) pthread_mutex_t lock;
+@property (nonatomic) dispatch_queue_t waveformQueue;
+@end
+
+//------------------------------------------------------------------------------
+
+@implementation EZAudioFile
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ self.floatConverter = nil;
+ pthread_mutex_destroy(&_lock);
+ [EZAudioUtilities freeFloatBuffers:self.floatData numberOfChannels:self.clientFormat.mChannelsPerFrame];
+ [EZAudioUtilities checkResult:ExtAudioFileDispose(self.info->extAudioFileRef) operation:"Failed to dispose of ext audio file"];
+ free(self.info);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self)
+ {
+ self.info = (EZAudioFileInfo *)malloc(sizeof(EZAudioFileInfo));
+ _floatData = NULL;
+ pthread_mutex_init(&_lock, NULL);
+ _waveformQueue = dispatch_queue_create(EZAudioFileWaveformDataQueueIdentifier.UTF8String, DISPATCH_QUEUE_PRIORITY_DEFAULT);
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+{
+ return [self initWithURL:url delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+{
+ return [self initWithURL:url
+ delegate:delegate
+ clientFormat:[self.class defaultClientFormat]];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+{
+ self = [self init];
+ if (self)
+ {
+ self.info->sourceURL = (__bridge CFURLRef)(url);
+ self.info->clientFormat = clientFormat;
+ self.delegate = delegate;
+ if (![self setup])
+ {
+ return nil;
+ }
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (instancetype)audioFileWithURL:(NSURL *)url
+{
+ return [[self alloc] initWithURL:url];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioFileWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+{
+ return [[self alloc] initWithURL:url delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioFileWithURL:(NSURL *)url
+ delegate:(id<EZAudioFileDelegate>)delegate
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+{
+ return [[self alloc] initWithURL:url
+ delegate:delegate
+ clientFormat:clientFormat];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - NSCopying
+//------------------------------------------------------------------------------
+
+- (id)copyWithZone:(NSZone *)zone
+{
+ return [EZAudioFile audioFileWithURL:self.url];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)defaultClientFormat
+{
+ return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:[self defaultClientFormatSampleRate]];
+}
+
+//------------------------------------------------------------------------------
+
++ (Float64)defaultClientFormatSampleRate
+{
+ return 44100.0f;
+}
+
+//------------------------------------------------------------------------------
+
++ (NSArray *)supportedAudioFileTypes
+{
+ return @
+ [
+ @"aac",
+ @"caf",
+ @"aif",
+ @"aiff",
+ @"aifc",
+ @"mp3",
+ @"mp4",
+ @"m4a",
+ @"snd",
+ @"au",
+ @"sd2",
+ @"wav"
+ ];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (BOOL)setup
+{
+ //
+ // Try to open the file, bail if the file could not be opened
+ //
+ BOOL success = [self openAudioFile];
+ if (!success)
+ {
+ return success;
+ }
+
+ //
+ // Set the client format
+ //
+ self.clientFormat = self.info->clientFormat;
+
+ return YES;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Creating/Opening Audio File
+//------------------------------------------------------------------------------
+
+- (BOOL)openAudioFile
+{
+ //
+ // Need a source url
+ //
+ NSAssert(self.info->sourceURL, @"EZAudioFile cannot be created without a source url!");
+
+ //
+ // Determine if the file actually exists
+ //
+ CFURLRef url = self.info->sourceURL;
+ NSURL *fileURL = (__bridge NSURL *)(url);
+ BOOL fileExists = [[NSFileManager defaultManager] fileExistsAtPath:fileURL.path];
+
+ //
+ // Create an ExtAudioFileRef for the file handle
+ //
+ if (fileExists)
+ {
+ [EZAudioUtilities checkResult:ExtAudioFileOpenURL(url, &self.info->extAudioFileRef)
+ operation:"Failed to create ExtAudioFileRef"];
+ }
+ else
+ {
+ return NO;
+ }
+
+ //
+ // Get the underlying AudioFileID
+ //
+ UInt32 propSize = sizeof(self.info->audioFileID);
+ [EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_AudioFile,
+ &propSize,
+ &self.info->audioFileID)
+ operation:"Failed to get underlying AudioFileID"];
+
+ //
+ // Store the file format
+ //
+ propSize = sizeof(self.info->fileFormat);
+ [EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_FileDataFormat,
+ &propSize,
+ &self.info->fileFormat)
+ operation:"Failed to get file audio format on existing audio file"];
+
+ //
+ // Get the total frames and duration
+ //
+ propSize = sizeof(SInt64);
+ [EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_FileLengthFrames,
+ &propSize,
+ &self.info->frames)
+ operation:"Failed to get total frames"];
+ self.info->duration = (NSTimeInterval) self.info->frames / self.info->fileFormat.mSampleRate;
+
+ return YES;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+- (void)readFrames:(UInt32)frames
+ audioBufferList:(AudioBufferList *)audioBufferList
+ bufferSize:(UInt32 *)bufferSize
+ eof:(BOOL *)eof
+{
+ if (pthread_mutex_trylock(&_lock) == 0)
+ {
+ // perform read
+ [EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
+ &frames,
+ audioBufferList)
+ operation:"Failed to read audio data from file"];
+ *bufferSize = frames;
+ *eof = frames == 0;
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(audioFileUpdatedPosition:)])
+ {
+ [self.delegate audioFileUpdatedPosition:self];
+ }
+
+ //
+ // Deprecated, but supported until 1.0
+ //
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
+ {
+ [self.delegate audioFile:self updatedPosition:[self frameIndex]];
+ }
+#pragma GCC diagnostic pop
+
+ if ([self.delegate respondsToSelector:@selector(audioFile:readAudio:withBufferSize:withNumberOfChannels:)])
+ {
+ // convert into float data
+ [self.floatConverter convertDataFromAudioBufferList:audioBufferList
+ withNumberOfFrames:*bufferSize
+ toFloatBuffers:self.floatData];
+
+ // notify delegate
+ UInt32 channels = self.clientFormat.mChannelsPerFrame;
+ [self.delegate audioFile:self
+ readAudio:self.floatData
+ withBufferSize:*bufferSize
+ withNumberOfChannels:channels];
+ }
+
+ pthread_mutex_unlock(&_lock);
+
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)seekToFrame:(SInt64)frame
+{
+ if (pthread_mutex_trylock(&_lock) == 0)
+ {
+ [EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
+ frame)
+ operation:"Failed to seek frame position within audio file"];
+
+ pthread_mutex_unlock(&_lock);
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(audioFileUpdatedPosition:)])
+ {
+ [self.delegate audioFileUpdatedPosition:self];
+ }
+
+ //
+ // Deprecated, but supported until 1.0
+ //
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
+ if ([self.delegate respondsToSelector:@selector(audioFile:updatedPosition:)])
+ {
+ [self.delegate audioFile:self updatedPosition:[self frameIndex]];
+ }
+#pragma GCC diagnostic pop
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)floatFormat
+{
+ return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:44100.0f];
+}
+
+//------------------------------------------------------------------------------
+
+- (EZAudioFloatData *)getWaveformData
+{
+ return [self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution];
+}
+
+//------------------------------------------------------------------------------
+
+- (EZAudioFloatData *)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
+{
+ EZAudioFloatData *waveformData;
+ if (pthread_mutex_trylock(&_lock) == 0)
+ {
+ // store current frame
+ SInt64 currentFrame = self.frameIndex;
+ BOOL interleaved = [EZAudioUtilities isInterleaved:self.clientFormat];
+ UInt32 channels = self.clientFormat.mChannelsPerFrame;
+ if (channels == 0)
+ {
+ // prevent division by zero
+ pthread_mutex_unlock(&_lock);
+ return nil;
+ }
+ float **data = (float **)malloc( sizeof(float*) * channels );
+ for (int i = 0; i < channels; i++)
+ {
+ data[i] = (float *)malloc( sizeof(float) * numberOfPoints );
+ }
+
+ // seek to 0
+ [EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
+ 0)
+ operation:"Failed to seek frame position within audio file"];
+
+ // calculate the required number of frames per buffer
+ SInt64 framesPerBuffer = ((SInt64) self.totalClientFrames / numberOfPoints);
+ SInt64 framesPerChannel = framesPerBuffer / channels;
+
+ // allocate an audio buffer list
+ AudioBufferList *audioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:(UInt32)framesPerBuffer
+ numberOfChannels:self.info->clientFormat.mChannelsPerFrame
+ interleaved:interleaved];
+
+ // read through file and calculate rms at each point
+ for (SInt64 i = 0; i < numberOfPoints; i++)
+ {
+ UInt32 bufferSize = (UInt32) framesPerBuffer;
+ [EZAudioUtilities checkResult:ExtAudioFileRead(self.info->extAudioFileRef,
+ &bufferSize,
+ audioBufferList)
+ operation:"Failed to read audio data from file waveform"];
+ if (interleaved)
+ {
+ float *buffer = (float *)audioBufferList->mBuffers[0].mData;
+ for (int channel = 0; channel < channels; channel++)
+ {
+ float channelData[framesPerChannel];
+ for (int frame = 0; frame < framesPerChannel; frame++)
+ {
+ channelData[frame] = buffer[frame * channels + channel];
+ }
+ float rms = [EZAudioUtilities RMS:channelData length:(UInt32)framesPerChannel];
+ data[channel][i] = rms;
+ }
+ }
+ else
+ {
+ for (int channel = 0; channel < channels; channel++)
+ {
+ float *channelData = audioBufferList->mBuffers[channel].mData;
+ float rms = [EZAudioUtilities RMS:channelData length:bufferSize];
+ data[channel][i] = rms;
+ }
+ }
+ }
+
+ // clean up
+ [EZAudioUtilities freeBufferList:audioBufferList];
+
+ // seek back to previous position
+ [EZAudioUtilities checkResult:ExtAudioFileSeek(self.info->extAudioFileRef,
+ currentFrame)
+ operation:"Failed to seek frame position within audio file"];
+
+ pthread_mutex_unlock(&_lock);
+
+ waveformData = [EZAudioFloatData dataWithNumberOfChannels:channels
+ buffers:(float **)data
+ bufferSize:numberOfPoints];
+
+ // cleanup
+ for (int i = 0; i < channels; i++)
+ {
+ free(data[i]);
+ }
+ free(data);
+ }
+ return waveformData;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)getWaveformDataWithCompletionBlock:(EZAudioWaveformDataCompletionBlock)waveformDataCompletionBlock
+{
+ [self getWaveformDataWithNumberOfPoints:EZAudioFileWaveformDefaultResolution
+ completion:waveformDataCompletionBlock];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)getWaveformDataWithNumberOfPoints:(UInt32)numberOfPoints
+ completion:(EZAudioWaveformDataCompletionBlock)completion
+{
+ if (!completion)
+ {
+ return;
+ }
+
+ // async get waveform data
+ __weak EZAudioFile *weakSelf = self;
+ dispatch_async(self.waveformQueue, ^{
+ EZAudioFloatData *waveformData = [weakSelf getWaveformDataWithNumberOfPoints:numberOfPoints];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ completion(waveformData.buffers, waveformData.bufferSize);
+ });
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)clientFormat
+{
+ return self.info->clientFormat;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)currentTime
+{
+ return [EZAudioUtilities MAP:(float)[self frameIndex]
+ leftMin:0.0f
+ leftMax:(float)[self totalFrames]
+ rightMin:0.0f
+ rightMax:[self duration]];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)duration
+{
+ return self.info->duration;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)fileFormat
+{
+ return self.info->fileFormat;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedCurrentTime
+{
+ return [EZAudioUtilities displayTimeStringFromSeconds:[self currentTime]];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedDuration
+{
+ return [EZAudioUtilities displayTimeStringFromSeconds:[self duration]];
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)frameIndex
+{
+ SInt64 frameIndex;
+ [EZAudioUtilities checkResult:ExtAudioFileTell(self.info->extAudioFileRef, &frameIndex)
+ operation:"Failed to get frame index"];
+ return frameIndex;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSDictionary *)metadata
+{
+ // get size of metadata property (dictionary)
+ UInt32 propSize = sizeof(self.info->audioFileID);
+ CFDictionaryRef metadata;
+ UInt32 writable;
+ [EZAudioUtilities checkResult:AudioFileGetPropertyInfo(self.info->audioFileID,
+ kAudioFilePropertyInfoDictionary,
+ &propSize,
+ &writable)
+ operation:"Failed to get the size of the metadata dictionary"];
+
+ // pull metadata
+ [EZAudioUtilities checkResult:AudioFileGetProperty(self.info->audioFileID,
+ kAudioFilePropertyInfoDictionary,
+ &propSize,
+ &metadata)
+ operation:"Failed to get metadata dictionary"];
+
+ // cast to NSDictionary
+ return (__bridge NSDictionary*)metadata;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)totalDuration
+{
+ return self.info->duration;
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)totalClientFrames
+{
+ SInt64 totalFrames = [self totalFrames];
+ AudioStreamBasicDescription clientFormat = self.info->clientFormat;
+ AudioStreamBasicDescription fileFormat = self.info->fileFormat;
+ BOOL sameSampleRate = clientFormat.mSampleRate == fileFormat.mSampleRate;
+ if (!sameSampleRate)
+ {
+ totalFrames = self.info->duration * clientFormat.mSampleRate;
+ }
+ return totalFrames;
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)totalFrames
+{
+ return self.info->frames;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSURL *)url
+{
+ return (__bridge NSURL*)self.info->sourceURL;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
+{
+ //
+ // Clear any float data currently cached
+ //
+ if (self.floatData)
+ {
+ self.floatData = nil;
+ }
+
+ //
+ // Client format can only be linear PCM!
+ //
+ NSAssert([EZAudioUtilities isLinearPCM:clientFormat], @"Client format must be linear PCM");
+
+ //
+ // Store the client format
+ //
+ self.info->clientFormat = clientFormat;
+
+ //
+ // Set the client format on the ExtAudioFileRef
+ //
+ [EZAudioUtilities checkResult:ExtAudioFileSetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_ClientDataFormat,
+ sizeof(clientFormat),
+ &clientFormat)
+ operation:"Couldn't set client data format on file"];
+
+ //
+ // Create a new float converter using the client format as the input format
+ //
+ self.floatConverter = [EZAudioFloatConverter converterWithInputFormat:clientFormat];
+
+ //
+ // Determine how big our float buffers need to be to hold a buffer of float
+ // data for the audio received callback.
+ //
+ UInt32 maxPacketSize;
+ UInt32 propSize = sizeof(maxPacketSize);
+ [EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_ClientMaxPacketSize,
+ &propSize,
+ &maxPacketSize)
+ operation:"Failed to get max packet size"];
+
+ self.floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:1024
+ numberOfChannels:self.clientFormat.mChannelsPerFrame];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setCurrentTime:(NSTimeInterval)currentTime
+{
+ NSAssert(currentTime < [self duration], @"Invalid seek operation, expected current time to be less than duration");
+ SInt64 frame = [EZAudioUtilities MAP:currentTime
+ leftMin:0.0f
+ leftMax:[self duration]
+ rightMin:0.0f
+ rightMax:[self totalFrames]];
+ [self seekToFrame:frame];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Description
+//------------------------------------------------------------------------------
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"%@ {\n"
+ " url: %@,\n"
+ " duration: %f,\n"
+ " totalFrames: %lld,\n"
+ " metadata: %@,\n"
+ " fileFormat: { %@ },\n"
+ " clientFormat: { %@ } \n"
+ "}",
+ [super description],
+ [self url],
+ [self duration],
+ [self totalFrames],
+ [self metadata],
+ [EZAudioUtilities stringForAudioStreamBasicDescription:[self fileFormat]],
+ [EZAudioUtilities stringForAudioStreamBasicDescription:[self clientFormat]]];
+}
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioFloatConverter.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+FOUNDATION_EXPORT UInt32 const EZAudioFloatConverterDefaultPacketSize;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFloatConverter
+//------------------------------------------------------------------------------
+
+@interface EZAudioFloatConverter : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
++ (instancetype)converterWithInputFormat:(AudioStreamBasicDescription)inputFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (nonatomic, assign, readonly) AudioStreamBasicDescription inputFormat;
+@property (nonatomic, assign, readonly) AudioStreamBasicDescription floatFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Instance Methods
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithInputFormat:(AudioStreamBasicDescription)inputFormat;
+
+//------------------------------------------------------------------------------
+
+- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ toFloatBuffers:(float **)buffers;
+
+//------------------------------------------------------------------------------
+
+- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ toFloatBuffers:(float **)buffers
+ packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions;
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioFloatConverter.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioFloatConverter.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+static UInt32 EZAudioFloatConverterDefaultOutputBufferSize = 128 * 32;
+UInt32 const EZAudioFloatConverterDefaultPacketSize = 2048;
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ AudioConverterRef converterRef;
+ AudioBufferList *floatAudioBufferList;
+ AudioStreamBasicDescription inputFormat;
+ AudioStreamBasicDescription outputFormat;
+ AudioStreamPacketDescription *packetDescriptions;
+ UInt32 packetsPerBuffer;
+} EZAudioFloatConverterInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - Callbacks
+//------------------------------------------------------------------------------
+
+OSStatus EZAudioFloatConverterCallback(AudioConverterRef inAudioConverter,
+ UInt32 *ioNumberDataPackets,
+ AudioBufferList *ioData,
+ AudioStreamPacketDescription **outDataPacketDescription,
+ void *inUserData)
+{
+ AudioBufferList *sourceBuffer = (AudioBufferList *)inUserData;
+
+ memcpy(ioData,
+ sourceBuffer,
+ sizeof(AudioBufferList) + (sourceBuffer->mNumberBuffers - 1) * sizeof(AudioBuffer));
+ sourceBuffer = NULL;
+
+ return noErr;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFloatConverter (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZAudioFloatConverter ()
+@property (nonatomic, assign) EZAudioFloatConverterInfo *info;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFloatConverter (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioFloatConverter
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
++ (instancetype)converterWithInputFormat:(AudioStreamBasicDescription)inputFormat
+{
+ return [[self alloc] initWithInputFormat:inputFormat];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ AudioConverterDispose(self.info->converterRef);
+ [EZAudioUtilities freeBufferList:self.info->floatAudioBufferList];
+ free(self.info->packetDescriptions);
+ free(self.info);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithInputFormat:(AudioStreamBasicDescription)inputFormat
+{
+ self = [super init];
+ if (self)
+ {
+ self.info = (EZAudioFloatConverterInfo *)malloc(sizeof(EZAudioFloatConverterInfo));
+ memset(self.info, 0, sizeof(EZAudioFloatConverterInfo));
+ self.info->inputFormat = inputFormat;
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ // create output format
+ self.info->outputFormat = [EZAudioUtilities floatFormatWithNumberOfChannels:self.info->inputFormat.mChannelsPerFrame
+ sampleRate:self.info->inputFormat.mSampleRate];
+
+ // create a new instance of the audio converter
+ [EZAudioUtilities checkResult:AudioConverterNew(&self.info->inputFormat,
+ &self.info->outputFormat,
+ &self.info->converterRef)
+ operation:"Failed to create new audio converter"];
+
+ // get max packets per buffer so you can allocate a proper AudioBufferList
+ UInt32 packetsPerBuffer = 0;
+ UInt32 outputBufferSize = EZAudioFloatConverterDefaultOutputBufferSize;
+ UInt32 sizePerPacket = self.info->inputFormat.mBytesPerPacket;
+ BOOL isVBR = sizePerPacket == 0;
+
+ // VBR
+ if (isVBR)
+ {
+ // determine the max output buffer size
+ UInt32 maxOutputPacketSize;
+ UInt32 propSize = sizeof(maxOutputPacketSize);
+ OSStatus result = AudioConverterGetProperty(self.info->converterRef,
+ kAudioConverterPropertyMaximumOutputPacketSize,
+ &propSize,
+ &maxOutputPacketSize);
+ if (result != noErr)
+ {
+ maxOutputPacketSize = EZAudioFloatConverterDefaultPacketSize;
+ }
+
+ // set the output buffer size to at least the max output size
+ if (maxOutputPacketSize > outputBufferSize)
+ {
+ outputBufferSize = maxOutputPacketSize;
+ }
+ packetsPerBuffer = outputBufferSize / maxOutputPacketSize;
+
+ // allocate memory for the packet descriptions
+ self.info->packetDescriptions = (AudioStreamPacketDescription *)malloc(sizeof(AudioStreamPacketDescription) * packetsPerBuffer);
+ }
+ else
+ {
+ packetsPerBuffer = outputBufferSize / sizePerPacket;
+ }
+ self.info->packetsPerBuffer = packetsPerBuffer;
+
+ // allocate the AudioBufferList to hold the float values
+ BOOL isInterleaved = [EZAudioUtilities isInterleaved:self.info->outputFormat];
+ self.info->floatAudioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:packetsPerBuffer
+ numberOfChannels:self.info->outputFormat.mChannelsPerFrame
+ interleaved:isInterleaved];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ toFloatBuffers:(float **)buffers
+{
+ [self convertDataFromAudioBufferList:audioBufferList
+ withNumberOfFrames:frames
+ toFloatBuffers:buffers
+ packetDescriptions:self.info->packetDescriptions];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ toFloatBuffers:(float **)buffers
+ packetDescriptions:(AudioStreamPacketDescription *)packetDescriptions
+{
+ if (frames != 0)
+ {
+ //
+ // Make sure the data size coming in is consistent with the number
+ // of frames we're actually getting
+ //
+ for (int i = 0; i < audioBufferList->mNumberBuffers; i++) {
+ audioBufferList->mBuffers[i].mDataByteSize = frames * self.info->inputFormat.mBytesPerFrame;
+ }
+
+ //
+ // Fill out the audio converter with the source buffer
+ //
+ [EZAudioUtilities checkResult:AudioConverterFillComplexBuffer(self.info->converterRef,
+ EZAudioFloatConverterCallback,
+ audioBufferList,
+ &frames,
+ self.info->floatAudioBufferList,
+ packetDescriptions ? packetDescriptions : self.info->packetDescriptions)
+ operation:"Failed to fill complex buffer in float converter"];
+
+ //
+ // Copy the converted buffers into the float buffer array stored
+ // in memory
+ //
+ for (int i = 0; i < self.info->floatAudioBufferList->mNumberBuffers; i++)
+ {
+ memcpy(buffers[i],
+ self.info->floatAudioBufferList->mBuffers[i].mData,
+ self.info->floatAudioBufferList->mBuffers[i].mDataByteSize);
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioFloatData.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFloatData
+//------------------------------------------------------------------------------
+
+@interface EZAudioFloatData : NSObject
+
+//------------------------------------------------------------------------------
+
++ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
+ buffers:(float **)buffers
+ bufferSize:(UInt32)bufferSize;
+
+//------------------------------------------------------------------------------
+
+@property (nonatomic, assign, readonly) int numberOfChannels;
+@property (nonatomic, assign, readonly) float **buffers;
+@property (nonatomic, assign, readonly) UInt32 bufferSize;
+
+//------------------------------------------------------------------------------
+
+- (float *)bufferForChannel:(int)channel;
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioFloatData.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioFloatData.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFloatData
+//------------------------------------------------------------------------------
+
+@interface EZAudioFloatData ()
+@property (nonatomic, assign, readwrite) int numberOfChannels;
+@property (nonatomic, assign, readwrite) float **buffers;
+@property (nonatomic, assign, readwrite) UInt32 bufferSize;
+@end
+
+//------------------------------------------------------------------------------
+
+@implementation EZAudioFloatData
+
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [EZAudioUtilities freeFloatBuffers:self.buffers
+ numberOfChannels:self.numberOfChannels];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)dataWithNumberOfChannels:(int)numberOfChannels
+ buffers:(float **)buffers
+ bufferSize:(UInt32)bufferSize
+{
+ id data = [[self alloc] init];
+ size_t size = sizeof(float) * bufferSize;
+ float **buffersCopy = [EZAudioUtilities floatBuffersWithNumberOfFrames:bufferSize
+ numberOfChannels:numberOfChannels];
+ for (int i = 0; i < numberOfChannels; i++)
+ {
+ memcpy(buffersCopy[i], buffers[i], size);
+ }
+ ((EZAudioFloatData *)data).buffers = buffersCopy;
+ ((EZAudioFloatData *)data).bufferSize = bufferSize;
+ ((EZAudioFloatData *)data).numberOfChannels = numberOfChannels;
+ return data;
+}
+
+//------------------------------------------------------------------------------
+
+- (float *)bufferForChannel:(int)channel
+{
+ float *buffer = NULL;
+ if (channel < self.numberOfChannels)
+ {
+ buffer = self.buffers[channel];
+ }
+ return buffer;
+}
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioOSX.m
+// EZAudio
+//
+// Created by Tommaso Piazza on 30/09/15.
+// Copyright © 2015 Andrew Breckenridge. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <EZAudioOSX/EZAudio.h>
--- /dev/null
+//
+// EZAudioPlayer.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 1/16/14.
+// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import "TargetConditionals.h"
+#import "EZAudioFile.h"
+#import "EZOutput.h"
+
+@class EZAudioPlayer;
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef NS_ENUM(NSUInteger, EZAudioPlayerState)
+{
+ EZAudioPlayerStateEndOfFile,
+ EZAudioPlayerStatePaused,
+ EZAudioPlayerStatePlaying,
+ EZAudioPlayerStateReadyToPlay,
+ EZAudioPlayerStateSeeking,
+ EZAudioPlayerStateUnknown,
+};
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `audioFile` property. Check the new value using the EZAudioPlayer's `audioFile` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeAudioFileNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `device` property. Check the new value using the EZAudioPlayer's `device` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeOutputDeviceNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's `pan` property. Check the new value using the EZAudioPlayer's `pan` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePanNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's play state. Check the new value using the EZAudioPlayer's `isPlaying` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePlayStateNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's `volume` property. Check the new value using the EZAudioPlayer's `volume` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeVolumeNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer has reached the end of a file and its `shouldLoop` property has been set to NO.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidReachEndOfFileNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer performs a seek via the `seekToFrame` method or `setCurrentTime:` property setter. Check the new `currentTime` or `frameIndex` value using the EZAudioPlayer's `currentTime` or `frameIndex` property, respectively.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidSeekNotification;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayerDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioPlayerDelegate provides event callbacks for the EZAudioPlayer. Since 0.5.0 the EZAudioPlayerDelegate provides a smaller set of delegate methods in favor of notifications to allow multiple receivers of the EZAudioPlayer event callbacks since only one player is typically used in an application. Specifically, these methods are provided for high frequency callbacks that wrap the EZAudioPlayer's internal EZAudioFile and EZOutput instances.
+ @warning These callbacks don't necessarily occur on the main thread so make sure you wrap any UI code in a GCD block like: dispatch_async(dispatch_get_main_queue(), ^{ // Update UI });
+ */
+@protocol EZAudioPlayerDelegate <NSObject>
+
+@optional
+
+//------------------------------------------------------------------------------
+
+/**
+ Triggered by the EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate of the read audio data as a float array instead of a buffer list. Common use case of this would be to visualize the float data using an audio plot or audio data dependent OpenGL sketch.
+ @param audioPlayer The instance of the EZAudioPlayer that triggered the event
+ @param buffer A float array of float arrays holding the audio data. buffer[0] would be the left channel's float array while buffer[1] would be the right channel's float array in a stereo file.
+ @param bufferSize The length of the buffers float arrays
+ @param numberOfChannels The number of channels. 2 for stereo, 1 for mono.
+ @param audioFile The instance of the EZAudioFile that the event was triggered from
+ */
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile;;
+
+//------------------------------------------------------------------------------
+
+/**
+ Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate of the current playback position. The framePosition provides the current frame position and can be calculated against the EZAudioPlayer's total frames using the `totalFrames` function from the EZAudioPlayer.
+ @param audioPlayer The instance of the EZAudioPlayer that triggered the event
+ @param framePosition The new frame index as a 64-bit signed integer
+ @param audioFile The instance of the EZAudioFile that the event was triggered from
+ */
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile;
+
+
+/**
+ Triggered by EZAudioPlayer's internal EZAudioFile's EZAudioFileDelegate callback and notifies the delegate that the end of the file has been reached.
+ @param audioPlayer The instance of the EZAudioPlayer that triggered the event
+ @param audioFile The instance of the EZAudioFile that the event was triggered from
+ */
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+reachedEndOfAudioFile:(EZAudioFile *)audioFile;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayer
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioPlayer provides an interface that combines the EZAudioFile and EZOutput to play local audio files. This class acts as the master delegate (the EZAudioFileDelegate) over whatever EZAudioFile instance, the `audioFile` property, it is using for playback as well as the EZOutputDelegate and EZOutputDataSource over whatever EZOutput instance is set as the `output`. Classes that want to get the EZAudioFileDelegate callbacks should implement the EZAudioPlayer's EZAudioPlayerDelegate on the EZAudioPlayer instance. Since 0.5.0 the EZAudioPlayer offers notifications over the usual delegate methods to allow multiple receivers to get the EZAudioPlayer's state changes since one player will typically be used in one application. The EZAudioPlayerDelegate, the `delegate`, provides callbacks for high frequency methods that simply wrap the EZAudioFileDelegate and EZOutputDelegate callbacks for providing the audio buffer played as well as the position updating (you will typically have one scrub bar in an application).
+ */
+@interface EZAudioPlayer : NSObject <EZAudioFileDelegate,
+ EZOutputDataSource,
+ EZOutputDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Properties
+///-----------------------------------------------------------
+
+/**
+ The EZAudioPlayerDelegate that will handle the audio player callbacks
+ */
+@property (nonatomic, weak) id<EZAudioPlayerDelegate> delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ A BOOL indicating whether the player should loop the file
+ */
+@property (nonatomic, assign) BOOL shouldLoop;
+
+//------------------------------------------------------------------------------
+
+/**
+ An EZAudioPlayerState value representing the current internal playback and file state of the EZAudioPlayer instance.
+ */
+@property (nonatomic, assign, readonly) EZAudioPlayerState state;
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Initializes the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
+ @param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
+ @return The newly created instance of the EZAudioPlayer
+ */
+- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
+ @param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
+ @param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
+ @return The newly created instance of the EZAudioPlayer
+ */
+- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
+ delegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the EZAudioPlayer with an EZAudioPlayerDelegate.
+ @param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
+ @return The newly created instance of the EZAudioPlayer
+ */
+- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
+ @param url The NSURL instance representing the file path of the audio file.
+ @return The newly created instance of the EZAudioPlayer
+ */
+- (instancetype)initWithURL:(NSURL*)url;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
+ @param url The NSURL instance representing the file path of the audio file.
+ @param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the initWithAudioFile: function instead.
+ @return The newly created instance of the EZAudioPlayer
+ */
+- (instancetype)initWithURL:(NSURL*)url
+ delegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Class initializer that creates a default EZAudioPlayer.
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayer;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class initializer that creates the EZAudioPlayer with an EZAudioFile instance. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
+ @param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class initializer that creates the EZAudioPlayer with an EZAudioFile instance and provides a way to assign the EZAudioPlayerDelegate on instantiation. This does not use the EZAudioFile by reference, but instead creates a separate EZAudioFile instance with the same file at the given file path provided by the internal NSURL to use for internal seeking so it doesn't cause any locking between the caller's instance of the EZAudioFile.
+ @param audioFile The instance of the EZAudioFile to use for initializing the EZAudioPlayer
+ @param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithAudioFile: function instead.
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
+ delegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class initializer that creates a default EZAudioPlayer with an EZAudioPlayerDelegate..
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file.
+ @param url The NSURL instance representing the file path of the audio file.
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayerWithURL:(NSURL*)url;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class initializer that creates the EZAudioPlayer with an NSURL instance representing the file path of the audio file and a caller to assign as the EZAudioPlayerDelegate on instantiation.
+ @param url The NSURL instance representing the file path of the audio file.
+ @param delegate The receiver that will act as the EZAudioPlayerDelegate. Set to nil if it should have no delegate or use the audioPlayerWithURL: function instead.
+ @return The newly created instance of the EZAudioPlayer
+ */
++ (instancetype)audioPlayerWithURL:(NSURL*)url
+ delegate:(id<EZAudioPlayerDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Singleton
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Shared Instance
+///-----------------------------------------------------------
+
+/**
+ The shared instance (singleton) of the audio player. Most applications will only have one instance of the EZAudioPlayer that can be reused with multiple different audio files.
+ * @return The shared instance of the EZAudioPlayer.
+ */
++ (instancetype)sharedAudioPlayer;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Properties
+///-----------------------------------------------------------
+
+/**
+ Provides the EZAudioFile instance that is being used as the datasource for playback. When set it creates a copy of the EZAudioFile provided for internal use. This does not use the EZAudioFile by reference, but instead creates a copy of the EZAudioFile instance provided.
+ */
+@property (nonatomic, readwrite, copy) EZAudioFile *audioFile;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
+ @warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
+ */
+@property (nonatomic, readwrite) NSTimeInterval currentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioDevice instance that is being used by the `output`. Similarly, setting this just sets the `device` property of the `output`.
+ */
+@property (readwrite) EZAudioDevice *device;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration of the audio file in seconds.
+ */
+@property (readonly) NSTimeInterval duration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current time as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedCurrentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedDuration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the EZOutput that is being used to handle the actual playback of the audio data. This property is also settable, but note that the EZAudioPlayer will become the output's EZOutputDataSource and EZOutputDelegate. To listen for the EZOutput's delegate methods your view should implement the EZAudioPlayerDelegate and set itself as the EZAudioPlayer's `delegate`.
+ */
+@property (nonatomic, strong, readwrite) EZOutput *output;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the frame index (a.k.a the seek positon) within the audio file being used for playback. This can be helpful when seeking through the audio file.
+ @return An SInt64 representing the current frame index within the audio file used for playback.
+ */
+@property (readonly) SInt64 frameIndex;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a flag indicating whether the EZAudioPlayer is currently playing back any audio.
+ @return A BOOL indicating whether or not the EZAudioPlayer is performing playback,
+ */
+@property (readonly) BOOL isPlaying;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current pan from the audio player's internal `output` component. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
+ */
+@property (nonatomic, assign) float pan;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the total amount of frames in the current audio file being used for playback.
+ @return A SInt64 representing the total amount of frames in the current audio file being used for playback.
+ */
+@property (readonly) SInt64 totalFrames;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the file path that's currently being used by the player for playback.
+ @return The NSURL representing the file path of the audio file being used for playback.
+ */
+@property (nonatomic, copy, readonly) NSURL *url;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current volume from the audio player's internal `output` component. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
+ */
+@property (nonatomic, assign) float volume;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Controlling Playback
+///-----------------------------------------------------------
+
+/**
+ Starts playback.
+ */
+- (void)play;
+
+//------------------------------------------------------------------------------
+
+/**
+ Loads an EZAudioFile and immediately starts playing it.
+ @param audioFile An EZAudioFile to use for immediate playback.
+ */
+- (void)playAudioFile:(EZAudioFile *)audioFile;
+
+//------------------------------------------------------------------------------
+
+/**
+ Pauses playback.
+ */
+- (void)pause;
+
+//------------------------------------------------------------------------------
+
+/**
+ Seeks playback to a specified frame within the internal EZAudioFile. This will notify the EZAudioFileDelegate (if specified) with the audioPlayer:updatedPosition:inAudioFile: function.
+ @param frame The new frame position to seek to as a SInt64.
+ */
+- (void)seekToFrame:(SInt64)frame;
+
+@end
--- /dev/null
+//
+// EZAudioPlayer.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 1/16/14.
+// Copyright (c) 2014 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioPlayer.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+NSString * const EZAudioPlayerDidChangeAudioFileNotification = @"EZAudioPlayerDidChangeAudioFileNotification";
+NSString * const EZAudioPlayerDidChangeOutputDeviceNotification = @"EZAudioPlayerDidChangeOutputDeviceNotification";
+NSString * const EZAudioPlayerDidChangePanNotification = @"EZAudioPlayerDidChangePanNotification";
+NSString * const EZAudioPlayerDidChangePlayStateNotification = @"EZAudioPlayerDidChangePlayStateNotification";
+NSString * const EZAudioPlayerDidChangeVolumeNotification = @"EZAudioPlayerDidChangeVolumeNotification";
+NSString * const EZAudioPlayerDidReachEndOfFileNotification = @"EZAudioPlayerDidReachEndOfFileNotification";
+NSString * const EZAudioPlayerDidSeekNotification = @"EZAudioPlayerDidSeekNotification";
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayer (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZAudioPlayer ()
+@property (nonatomic, assign, readwrite) EZAudioPlayerState state;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayer (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioPlayer
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayer
+{
+ return [[self alloc] init];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayerWithDelegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ return [[self alloc] initWithDelegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
+{
+ return [[self alloc] initWithAudioFile:audioFile];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayerWithAudioFile:(EZAudioFile *)audioFile
+ delegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ return [[self alloc] initWithAudioFile:audioFile
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayerWithURL:(NSURL *)url
+{
+ return [[self alloc] initWithURL:url];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)audioPlayerWithURL:(NSURL *)url
+ delegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ return [[self alloc] initWithURL:url delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithDelegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ self = [self init];
+ if (self)
+ {
+ self.delegate = delegate;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
+{
+ return [self initWithAudioFile:audioFile delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithAudioFile:(EZAudioFile *)audioFile
+ delegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ self = [self initWithDelegate:delegate];
+ if (self)
+ {
+ self.audioFile = audioFile;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+{
+ return [self initWithURL:url delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ delegate:(id<EZAudioPlayerDelegate>)delegate
+{
+ self = [self initWithDelegate:delegate];
+ if (self)
+ {
+ self.audioFile = [EZAudioFile audioFileWithURL:url delegate:self];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Singleton
+//------------------------------------------------------------------------------
+
++ (instancetype)sharedAudioPlayer
+{
+ static EZAudioPlayer *player;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^
+ {
+ player = [[self alloc] init];
+ });
+ return player;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ self.output = [EZOutput output];
+ self.state = EZAudioPlayerStateReadyToPlay;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)currentTime
+{
+ return [self.audioFile currentTime];
+}
+
+//------------------------------------------------------------------------------
+
+- (EZAudioDevice *)device
+{
+ return [self.output device];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)duration
+{
+ return [self.audioFile duration];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedCurrentTime
+{
+ return [self.audioFile formattedCurrentTime];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedDuration
+{
+ return [self.audioFile formattedDuration];
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)frameIndex
+{
+ return [self.audioFile frameIndex];
+}
+
+//------------------------------------------------------------------------------
+
+- (BOOL)isPlaying
+{
+ return [self.output isPlaying];
+}
+
+//------------------------------------------------------------------------------
+
+- (float)pan
+{
+ return [self.output pan];
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)totalFrames
+{
+ return [self.audioFile totalFrames];
+}
+
+//------------------------------------------------------------------------------
+
+- (float)volume
+{
+ return [self.output volume];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setAudioFile:(EZAudioFile *)audioFile
+{
+ _audioFile = [audioFile copy];
+ _audioFile.delegate = self;
+ AudioStreamBasicDescription inputFormat = _audioFile.clientFormat;
+ [self.output setInputFormat:inputFormat];
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeAudioFileNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setCurrentTime:(NSTimeInterval)currentTime
+{
+ [self.audioFile setCurrentTime:currentTime];
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setDevice:(EZAudioDevice *)device
+{
+ [self.output setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setOutput:(EZOutput *)output
+{
+ _output = output;
+ _output.dataSource = self;
+ _output.delegate = self;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setPan:(float)pan
+{
+ [self.output setPan:pan];
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangePanNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setVolume:(float)volume
+{
+ [self.output setVolume:volume];
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeVolumeNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)play
+{
+ [self.output startPlayback];
+ self.state = EZAudioPlayerStatePlaying;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)playAudioFile:(EZAudioFile *)audioFile
+{
+ //
+ // stop playing anything that might currently be playing
+ //
+ [self pause];
+
+ //
+ // set new stream
+ //
+ self.audioFile = audioFile;
+
+ //
+ // begin playback
+ //
+ [self play];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)pause
+{
+ [self.output stopPlayback];
+ self.state = EZAudioPlayerStatePaused;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)seekToFrame:(SInt64)frame
+{
+ self.state = EZAudioPlayerStateSeeking;
+ [self.audioFile seekToFrame:frame];
+ self.state = self.isPlaying ? EZAudioPlayerStatePlaying : EZAudioPlayerStatePaused;
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidSeekNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutputDataSource
+//------------------------------------------------------------------------------
+
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp
+{
+ if (self.audioFile)
+ {
+ UInt32 bufferSize;
+ BOOL eof;
+ [self.audioFile readFrames:frames
+ audioBufferList:audioBufferList
+ bufferSize:&bufferSize
+ eof:&eof];
+ if (eof && [self.delegate respondsToSelector:@selector(audioPlayer:reachedEndOfAudioFile:)])
+ {
+ [self.delegate audioPlayer:self reachedEndOfAudioFile:self.audioFile];
+ }
+ if (eof && self.shouldLoop)
+ {
+ [self seekToFrame:0];
+ }
+ else if (eof)
+ {
+ [self pause];
+ [self seekToFrame:0];
+ self.state = EZAudioPlayerStateEndOfFile;
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidReachEndOfFileNotification
+ object:self];
+ }
+ }
+ return noErr;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFileDelegate
+//------------------------------------------------------------------------------
+
+- (void)audioFileUpdatedPosition:(EZAudioFile *)audioFile
+{
+ if ([self.delegate respondsToSelector:@selector(audioPlayer:updatedPosition:inAudioFile:)])
+ {
+ [self.delegate audioPlayer:self
+ updatedPosition:[audioFile frameIndex]
+ inAudioFile:audioFile];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutputDelegate
+//------------------------------------------------------------------------------
+
+- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device
+{
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangeOutputDeviceNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)output:(EZOutput *)output changedPlayingState:(BOOL)isPlaying
+{
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidChangePlayStateNotification
+ object:self];
+}
+
+//------------------------------------------------------------------------------
+
+- (void) output:(EZOutput *)output
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ if ([self.delegate respondsToSelector:@selector(audioPlayer:playedAudio:withBufferSize:withNumberOfChannels:inAudioFile:)])
+ {
+ [self.delegate audioPlayer:self
+ playedAudio:buffer
+ withBufferSize:bufferSize
+ withNumberOfChannels:numberOfChannels
+ inAudioFile:self.audioFile];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioPlot.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 9/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <QuartzCore/QuartzCore.h>
+#import "EZPlot.h"
+#import "EZAudioDisplayLink.h"
+
+@class EZAudio;
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+/**
+ The default value used for the maximum rolling history buffer length of any EZAudioPlot.
+ @deprecated This constant is deprecated starting in version 0.2.0.
+ @note Please use EZAudioPlotDefaultMaxHistoryBufferLength instead.
+ */
+FOUNDATION_EXPORT UInt32 const kEZAudioPlotMaxHistoryBufferLength __attribute__((deprecated));
+
+/**
+ The default value used for the default rolling history buffer length of any EZAudioPlot.
+ @deprecated This constant is deprecated starting in version 0.2.0.
+ @note Please use EZAudioPlotDefaultHistoryBufferLength instead.
+ */
+FOUNDATION_EXPORT UInt32 const kEZAudioPlotDefaultHistoryBufferLength __attribute__((deprecated));
+
+/**
+ The default value used for the default rolling history buffer length of any EZAudioPlot.
+ */
+FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultHistoryBufferLength;
+
+/**
+ The default value used for the maximum rolling history buffer length of any EZAudioPlot.
+ */
+FOUNDATION_EXPORT UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlotWaveformLayer
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioPlotWaveformLayer is a lightweight subclass of the CAShapeLayer that allows implicit animations on the `path` key.
+ */
+@interface EZAudioPlotWaveformLayer : CAShapeLayer
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlot
+//------------------------------------------------------------------------------
+
+/**
+ `EZAudioPlot`, a subclass of `EZPlot`, is a cross-platform (iOS and OSX) class that plots an audio waveform using Core Graphics.
+
+ The caller provides updates a constant stream of updated audio data in the `updateBuffer:withBufferSize:` function, which in turn will be plotted in one of the plot types:
+
+ * Buffer (`EZPlotTypeBuffer`) - A plot that only consists of the current buffer and buffer size from the last call to `updateBuffer:withBufferSize:`. This looks similar to the default openFrameworks input audio example.
+ * Rolling (`EZPlotTypeRolling`) - A plot that consists of a rolling history of values averaged from each buffer. This is the traditional waveform look.
+
+ #Parent Methods and Properties#
+
+ See EZPlot for full API methods and properties (colors, plot type, update function)
+
+ */
+@interface EZAudioPlot : EZPlot
+
+/**
+ A BOOL that allows optimizing the audio plot's drawing for real-time displays. Since the update function may be updating the plot's data very quickly (over 60 frames per second) this property will throttle the drawing calls to be 60 frames per second (or whatever the screen rate is). Specifically, it disables implicit path change animations on the `waveformLayer` and sets up a display link to render 60 fps (audio updating the plot at 44.1 kHz causes it to re-render 86 fps - far greater than what is needed for a visual display).
+ */
+@property (nonatomic, assign) BOOL shouldOptimizeForRealtimePlot;
+
+//------------------------------------------------------------------------------
+
+/**
+ A BOOL indicating whether the plot should center itself vertically.
+ */
+@property (nonatomic, assign) BOOL shouldCenterYAxis;
+
+//------------------------------------------------------------------------------
+
+/**
+ An EZAudioPlotWaveformLayer that is used to render the actual waveform. By switching the drawing code to Core Animation layers in version 0.2.0 most work, specifically the compositing step, is now done on the GPU. Hence, multiple EZAudioPlot instances can be used simultaneously with very low CPU overhead so these are now practical for table and collection views.
+ */
+@property (nonatomic, strong) EZAudioPlotWaveformLayer *waveformLayer;
+
+//------------------------------------------------------------------------------
+#pragma mark - Adjust Resolution
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Adjusting The Resolution
+///-----------------------------------------------------------
+
+/**
+ Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
+ @param historyLength The new length of the rolling history buffer.
+ @return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
+ */
+-(int)setRollingHistoryLength:(int)historyLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
+ * @return An int representing the length of the rolling history buffer
+ */
+-(int)rollingHistoryLength;
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass Methods
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Subclass Methods
+///-----------------------------------------------------------
+
+/**
+ Main method that handles converting the points created from the `updatedBuffer:withBufferSize:` method into a CGPathRef to store in the `waveformLayer`. In this method you can create any path you'd like using the point array (for instance, maybe mapping the points to a circle instead of the standard 2D plane).
+ @param points An array of CGPoint structures, with the x values ranging from 0 - (pointCount - 1) and y values containing the last audio data's buffer.
+ @param pointCount A UInt32 of the length of the point array.
+ @param rect An EZRect (CGRect on iOS or NSRect on OSX) that the path should be created relative to.
+ @return A CGPathRef that is the path you'd like to store on the `waveformLayer` to visualize the audio data.
+ */
+- (CGPathRef)createPathWithPoints:(CGPoint *)points
+ pointCount:(UInt32)pointCount
+ inRect:(EZRect)rect;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
+ @return An int describing the initial length of the rolling history buffer.
+ */
+- (int)defaultRollingHistoryLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Called after the view has been created. Subclasses should use to add any additional methods needed instead of overriding the init methods.
+ */
+- (void)setupPlot;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the default number of points that will be used to initialize the graph's points data structure that holds. Essentially the plot starts off as a flat line of this many points. Default is 100.
+ @return An int describing the initial number of points the plot should have when flat lined.
+ */
+- (int)initialPointCount;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
+ @return An int describing the maximum length of the absolute rolling history buffer.
+ */
+- (int)maximumRollingHistoryLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Method to cause the waveform layer's path to get recreated and redrawn on screen using the last buffer of data provided. This is the equivalent to the drawRect: method used to normally subclass a view's drawing. This normally don't need to be overrode though - a better approach would be to override the `createPathWithPoints:pointCount:inRect:` method.
+ */
+- (void)redraw;
+
+//------------------------------------------------------------------------------
+
+/**
+ 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;
+
+//------------------------------------------------------------------------------
+
+@end
+
+@interface EZAudioPlot () <EZAudioDisplayLinkDelegate>
+@property (nonatomic, strong) EZAudioDisplayLink *displayLink;
+@property (nonatomic, assign) EZPlotHistoryInfo *historyInfo;
+@property (nonatomic, assign) CGPoint *points;
+@property (nonatomic, assign) UInt32 pointCount;
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioPlot.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 9/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioPlot.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+UInt32 const kEZAudioPlotMaxHistoryBufferLength = 8192;
+UInt32 const kEZAudioPlotDefaultHistoryBufferLength = 512;
+UInt32 const EZAudioPlotDefaultHistoryBufferLength = 512;
+UInt32 const EZAudioPlotDefaultMaxHistoryBufferLength = 8192;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlot (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioPlot
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [EZAudioUtilities freeHistoryInfo:self.historyInfo];
+ free(self.points);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (id)init
+{
+ self = [super init];
+ if (self)
+ {
+ [self initPlot];
+ }
+ return self;
+}
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+ self = [super initWithCoder:aDecoder];
+ if (self)
+ {
+ [self initPlot];
+ }
+ return self;
+}
+
+#if TARGET_OS_IPHONE
+- (id)initWithFrame:(CGRect)frameRect
+#elif TARGET_OS_MAC
+- (id)initWithFrame:(NSRect)frameRect
+#endif
+{
+ self = [super initWithFrame:frameRect];
+ if (self)
+ {
+ [self initPlot];
+ }
+ return self;
+}
+
+#if TARGET_OS_IPHONE
+- (void)layoutSubviews
+{
+ [super layoutSubviews];
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ self.waveformLayer.frame = self.bounds;
+ [self redraw];
+ [CATransaction commit];
+}
+#elif TARGET_OS_MAC
+- (void)layout
+{
+ [super layout];
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ self.waveformLayer.frame = self.bounds;
+ [self redraw];
+ [CATransaction commit];
+}
+#endif
+
+- (void)initPlot
+{
+ self.shouldCenterYAxis = YES;
+ self.shouldOptimizeForRealtimePlot = YES;
+ self.gain = 1.0;
+ self.plotType = EZPlotTypeBuffer;
+ self.shouldMirror = NO;
+ self.shouldFill = NO;
+
+ // Setup history window
+ [self resetHistoryBuffers];
+
+ self.waveformLayer = [EZAudioPlotWaveformLayer layer];
+ self.waveformLayer.frame = self.bounds;
+ self.waveformLayer.lineWidth = 1.0f;
+ self.waveformLayer.fillColor = nil;
+ self.waveformLayer.backgroundColor = nil;
+ self.waveformLayer.opaque = YES;
+
+#if TARGET_OS_IPHONE
+ self.color = [UIColor colorWithHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
+#elif TARGET_OS_MAC
+ self.color = [NSColor colorWithCalibratedHue:0 saturation:1.0 brightness:1.0 alpha:1.0];
+ self.wantsLayer = YES;
+ self.layerContentsRedrawPolicy = NSViewLayerContentsRedrawOnSetNeedsDisplay;
+#endif
+ 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
+//------------------------------------------------------------------------------
+
+- (void)resetHistoryBuffers
+{
+ //
+ // Clear any existing data
+ //
+ if (self.historyInfo)
+ {
+ [EZAudioUtilities freeHistoryInfo:self.historyInfo];
+ }
+
+ self.historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:[self defaultRollingHistoryLength]
+ maximumLength:[self maximumRollingHistoryLength]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setBackgroundColor:(id)backgroundColor
+{
+ [super setBackgroundColor:backgroundColor];
+ self.layer.backgroundColor = [backgroundColor CGColor];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setColor:(id)color
+{
+ [super setColor:color];
+ self.waveformLayer.strokeColor = [color CGColor];
+ if (self.shouldFill)
+ {
+ self.waveformLayer.fillColor = [color CGColor];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setShouldOptimizeForRealtimePlot:(BOOL)shouldOptimizeForRealtimePlot
+{
+ _shouldOptimizeForRealtimePlot = shouldOptimizeForRealtimePlot;
+ if (shouldOptimizeForRealtimePlot && !self.displayLink)
+ {
+ self.displayLink = [EZAudioDisplayLink displayLinkWithDelegate:self];
+ [self.displayLink start];
+ }
+ else
+ {
+ [self.displayLink stop];
+ self.displayLink = nil;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setShouldFill:(BOOL)shouldFill
+{
+ [super setShouldFill:shouldFill];
+ self.waveformLayer.fillColor = shouldFill ? [self.color CGColor] : nil;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Drawing
+//------------------------------------------------------------------------------
+
+- (void)clear
+{
+ if (self.pointCount > 0)
+ {
+ [self resetHistoryBuffers];
+ float data[self.pointCount];
+ memset(data, 0, self.pointCount * sizeof(float));
+ [self setSampleData:data length:self.pointCount];
+ [self redraw];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)redraw
+{
+ EZRect frame = [self.waveformLayer frame];
+ CGPathRef path = [self createPathWithPoints:self.points
+ pointCount:self.pointCount
+ inRect:frame];
+ if (self.shouldOptimizeForRealtimePlot)
+ {
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ self.waveformLayer.path = path;
+ [CATransaction commit];
+ }
+ else
+ {
+ self.waveformLayer.path = path;
+ }
+ CGPathRelease(path);
+}
+
+//------------------------------------------------------------------------------
+
+- (CGPathRef)createPathWithPoints:(CGPoint *)points
+ pointCount:(UInt32)pointCount
+ inRect:(EZRect)rect
+{
+ CGMutablePathRef path = NULL;
+ if (pointCount > 0)
+ {
+ path = CGPathCreateMutable();
+ double xscale = (rect.size.width) / ((float)self.pointCount);
+ double halfHeight = floor(rect.size.height / 2.0);
+ int deviceOriginFlipped = [self isDeviceOriginFlipped] ? -1 : 1;
+ CGAffineTransform xf = CGAffineTransformIdentity;
+ CGFloat translateY = 0.0f;
+ if (!self.shouldCenterYAxis)
+ {
+#if TARGET_OS_IPHONE
+ translateY = CGRectGetHeight(rect);
+#elif TARGET_OS_MAC
+ translateY = 0.0f;
+#endif
+ }
+ else
+ {
+ translateY = halfHeight + rect.origin.y;
+ }
+ xf = CGAffineTransformTranslate(xf, 0.0, translateY);
+ double yScaleFactor = halfHeight;
+ if (!self.shouldCenterYAxis)
+ {
+ yScaleFactor = 2.0 * halfHeight;
+ }
+ xf = CGAffineTransformScale(xf, xscale, deviceOriginFlipped * yScaleFactor);
+ CGPathAddLines(path, &xf, self.points, self.pointCount);
+ if (self.shouldMirror)
+ {
+ xf = CGAffineTransformScale(xf, 1.0f, -1.0f);
+ CGPathAddLines(path, &xf, self.points, self.pointCount);
+ }
+ if (self.shouldFill)
+ {
+ CGPathCloseSubpath(path);
+ }
+ }
+ return path;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Update
+//------------------------------------------------------------------------------
+
+- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
+{
+ // append the buffer to the history
+ [EZAudioUtilities appendBufferRMS:buffer
+ withBufferSize:bufferSize
+ toHistoryInfo:self.historyInfo];
+
+ // copy samples
+ switch (self.plotType)
+ {
+ case EZPlotTypeBuffer:
+ [self setSampleData:buffer
+ length:bufferSize];
+ break;
+ case EZPlotTypeRolling:
+
+ [self setSampleData:self.historyInfo->buffer
+ length:self.historyInfo->bufferSize];
+ break;
+ default:
+ break;
+ }
+
+ // update drawing
+ if (!self.shouldOptimizeForRealtimePlot)
+ {
+ [self redraw];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setSampleData:(float *)data length:(int)length
+{
+ CGPoint *points = self.points;
+ for (int i = 0; i < length; i++)
+ {
+ points[i].x = i;
+ points[i].y = data[i] * self.gain;
+ }
+ points[0].y = points[length - 1].y = 0.0f;
+ self.pointCount = length;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Adjusting History Resolution
+//------------------------------------------------------------------------------
+
+- (int)rollingHistoryLength
+{
+ return self.historyInfo->bufferSize;
+}
+
+//------------------------------------------------------------------------------
+
+- (int)setRollingHistoryLength:(int)historyLength
+{
+ self.historyInfo->bufferSize = MIN(EZAudioPlotDefaultMaxHistoryBufferLength, historyLength);
+ return self.historyInfo->bufferSize;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+- (int)defaultRollingHistoryLength
+{
+ return EZAudioPlotDefaultHistoryBufferLength;
+}
+
+//------------------------------------------------------------------------------
+
+- (int)initialPointCount
+{
+ return 100;
+}
+
+//------------------------------------------------------------------------------
+
+- (int)maximumRollingHistoryLength
+{
+ return EZAudioPlotDefaultMaxHistoryBufferLength;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
+- (BOOL)isDeviceOriginFlipped
+{
+ BOOL isDeviceOriginFlipped = NO;
+#if TARGET_OS_IPHONE
+ isDeviceOriginFlipped = YES;
+#elif TARGET_OS_MAC
+#endif
+ return isDeviceOriginFlipped;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLinkDelegate
+//------------------------------------------------------------------------------
+
+- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink
+{
+ [self redraw];
+}
+
+//------------------------------------------------------------------------------
+
+@end
+
+////------------------------------------------------------------------------------
+#pragma mark - EZAudioPlotWaveformLayer (Implementation)
+////------------------------------------------------------------------------------
+
+@implementation EZAudioPlotWaveformLayer
+
+- (id<CAAction>)actionForKey:(NSString *)event
+{
+ if ([event isEqualToString:@"path"])
+ {
+ if ([CATransaction disableActions])
+ {
+ return nil;
+ }
+ else
+ {
+ CABasicAnimation *animation = [CABasicAnimation animation];
+ animation.timingFunction = [CATransaction animationTimingFunction];
+ animation.duration = [CATransaction animationDuration];
+ return animation;
+ }
+ return nil;
+ }
+ return [super actionForKey:event];
+}
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioPlotGL.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 11/22/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <GLKit/GLKit.h>
+#import "EZPlot.h"
+#if !TARGET_OS_IPHONE
+#import <OpenGL/OpenGL.h>
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ GLfloat x;
+ GLfloat y;
+} EZAudioPlotGLPoint;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlotGL
+//------------------------------------------------------------------------------
+
+/**
+ EZAudioPlotGL is a subclass of either a GLKView on iOS or an NSOpenGLView on OSX. As of 0.6.0 this class no longer depends on an embedded GLKViewController for iOS as the display link is just manually managed within this single view instead. The EZAudioPlotGL provides the same kind of audio plot as the EZAudioPlot, but uses OpenGL to GPU-accelerate the drawing of the points, which means you can fit a lot more points and complex geometries.
+ */
+#if TARGET_OS_IPHONE
+@interface EZAudioPlotGL : GLKView
+#elif TARGET_OS_MAC
+@interface EZAudioPlotGL : NSOpenGLView
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Customizing The Plot's Appearance
+///-----------------------------------------------------------
+
+/**
+ 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.
+ */
+#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.
+ */
+#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) IBInspectable float gain;
+
+//------------------------------------------------------------------------------
+
+/**
+ The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type). Default is EZPlotTypeBuffer.
+ */
+@property (nonatomic, assign) EZPlotType plotType;
+
+//------------------------------------------------------------------------------
+
+/**
+ 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) 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) IBInspectable BOOL shouldMirror;
+
+//------------------------------------------------------------------------------
+#pragma mark - Updating The Plot
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Updating The Plot
+///-----------------------------------------------------------
+
+/**
+ Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
+ @param buffer A float array of values to map to the y-axis.
+ @param bufferSize The size of the float array that will be mapped to the y-axis.
+ */
+-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
+
+//------------------------------------------------------------------------------
+#pragma mark - Adjust Resolution
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Adjusting The Resolution
+///-----------------------------------------------------------
+
+/**
+ Sets the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer). Can grow or shrink the display up to the maximum size specified by the `maximumRollingHistoryLength` method. Will return the actual set value, which will be either the given value if smaller than the `maximumRollingHistoryLength` or `maximumRollingHistoryLength` if a larger value is attempted to be set.
+ @param historyLength The new length of the rolling history buffer.
+ @return The new value equal to the historyLength or the `maximumRollingHistoryLength`.
+ */
+-(int)setRollingHistoryLength:(int)historyLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the length of the rolling history buffer (i.e. the number of points in the rolling plot's buffer).
+ * @return An int representing the length of the rolling history buffer
+ */
+-(int)rollingHistoryLength;
+
+//------------------------------------------------------------------------------
+#pragma mark - Clearing The Plot
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Clearing The Plot
+///-----------------------------------------------------------
+
+/**
+ Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
+ */
+-(void)clear;
+
+//------------------------------------------------------------------------------
+#pragma mark - Start/Stop Display Link
+//------------------------------------------------------------------------------
+
+/**
+ Call this method to tell the EZAudioDisplayLink to stop drawing temporarily.
+ */
+- (void)pauseDrawing;
+
+//------------------------------------------------------------------------------
+
+/**
+ Call this method to manually tell the EZAudioDisplayLink to start drawing again.
+ */
+- (void)resumeDrawing;
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Customizing The Drawing
+///-----------------------------------------------------------
+
+/**
+ This method is used to perform the actual OpenGL drawing code to clear the background and draw the lines representing the 2D audio plot. Subclasses can use the current implementation as an example and implement their own custom geometries. This is the analogy of overriding the drawRect: method in an NSView or UIView.
+ @param points An array of EZAudioPlotGLPoint structures representing the mapped audio data to x,y coordinates. The x-axis goes from 0 to the number of points (pointCount) while the y-axis goes from -1 to 1. Check out the implementation of this method to see how the model view matrix of the base effect is transformed to map this properly to the viewport.
+ @param pointCount A UInt32 representing the number of points contained in the points array.
+ @param baseEffect An optional GLKBaseEffect to use as a default shader. Call prepareToDraw on the base effect before any glDrawArrays call.
+ @param vbo The Vertex Buffer Object used to buffer the point data.
+ @param vab The Vertex Array Buffer used to bind the Vertex Buffer Object. This is a Mac only thing, you can ignore this completely on iOS.
+ @param interpolated A BOOL indicating whether the data has been interpolated. This means the point data is twice as long, where every other point is 0 on the y-axis to allow drawing triangle stripes for filled in waveforms. Typically if the point data is interpolated you will be using the GL_TRIANGLE_STRIP drawing mode, while non-interpolated plots will just use a GL_LINE_STRIP drawing mode.
+ @param mirrored A BOOL indicating whether the plot should be mirrored about the y-axis (or whatever geometry you come up with).
+ @param gain A float representing a gain that should be used to influence the height or intensity of your geometry's shape. A gain of 0.0 means silence, a gain of 1.0 means full volume (you're welcome to boost this to whatever you want).
+ */
+- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
+ pointCount:(UInt32)pointCount
+ baseEffect:(GLKBaseEffect *)baseEffect
+ vertexBufferObject:(GLuint)vbo
+ vertexArrayBuffer:(GLuint)vab
+ interpolated:(BOOL)interpolated
+ mirrored:(BOOL)mirrored
+ gain:(float)gain;
+
+//------------------------------------------------------------------------------
+
+/**
+ 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
+///-----------------------------------------------------------
+
+/**
+ Provides the default length of the rolling history buffer when the plot is initialized. Default is `EZAudioPlotDefaultHistoryBufferLength` constant.
+ @return An int describing the initial length of the rolling history buffer.
+ */
+- (int)defaultRollingHistoryLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the default maximum rolling history length - that is, the maximum amount of points the `setRollingHistoryLength:` method may be set to. If a length higher than this is set then the plot will likely crash because the appropriate resources are only allocated once during the plot's initialization step. Defualt is `EZAudioPlotDefaultMaxHistoryBufferLength` constant.
+ @return An int describing the maximum length of the absolute rolling history buffer.
+ */
+- (int)maximumRollingHistoryLength;
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioPlotGL.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 11/22/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioPlotGL.h"
+#import "EZAudioDisplayLink.h"
+#import "EZAudioUtilities.h"
+#import "EZAudioPlot.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ BOOL interpolated;
+ EZPlotHistoryInfo *historyInfo;
+ EZAudioPlotGLPoint *points;
+ UInt32 pointCount;
+ GLuint vbo;
+ GLuint vab;
+} EZAudioPlotGLInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlotGL (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZAudioPlotGL () <EZAudioDisplayLinkDelegate>
+@property (nonatomic, strong) GLKBaseEffect *baseEffect;
+@property (nonatomic, strong) EZAudioDisplayLink *displayLink;
+@property (nonatomic, assign) EZAudioPlotGLInfo *info;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlotGL (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZAudioPlotGL
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [self.displayLink stop];
+ self.displayLink = nil;
+ [EZAudioUtilities freeHistoryInfo:self.info->historyInfo];
+#if !TARGET_OS_IPHONE
+ glDeleteVertexArrays(1, &self.info->vab);
+#endif
+ glDeleteBuffers(1, &self.info->vbo);
+ free(self.info->points);
+ free(self.info);
+ self.baseEffect = nil;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (id)initWithCoder:(NSCoder *)aDecoder
+{
+ self = [super initWithCoder:aDecoder];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithFrame:(EZRect)frame
+{
+ self = [super initWithFrame:frame];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+#if TARGET_OS_IPHONE
+- (instancetype)initWithFrame:(CGRect)frame
+ context:(EAGLContext *)context
+{
+ self = [super initWithFrame:frame context:context];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+#elif TARGET_OS_MAC
+- (instancetype)initWithFrame:(NSRect)frameRect
+ pixelFormat:(NSOpenGLPixelFormat *)format
+{
+ self = [super initWithFrame:frameRect pixelFormat:format];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ //
+ // Setup info data structure
+ //
+ self.info = (EZAudioPlotGLInfo *)malloc(sizeof(EZAudioPlotGLInfo));
+ memset(self.info, 0, sizeof(EZAudioPlotGLInfo));
+
+ //
+ // Create points array
+ //
+ UInt32 pointCount = [self maximumRollingHistoryLength];
+ self.info->points = (EZAudioPlotGLPoint *)calloc(sizeof(EZAudioPlotGLPoint), pointCount);
+ self.info->pointCount = pointCount;
+
+ //
+ // Create the history data structure to hold the rolling data
+ //
+ self.info->historyInfo = [EZAudioUtilities historyInfoWithDefaultLength:[self defaultRollingHistoryLength]
+ maximumLength:[self maximumRollingHistoryLength]];
+
+ //
+ // Setup OpenGL specific stuff
+ //
+ [self setupOpenGL];
+
+ //
+ // Setup view properties
+ //
+ self.gain = 1.0f;
+#if TARGET_OS_IPHONE
+ self.backgroundColor = [UIColor colorWithRed:0.569f green:0.82f blue:0.478f alpha:1.0f];
+ self.color = [UIColor colorWithRed:1.0f green:1.0f blue:1.0f alpha:1.0f];
+#elif TARGET_OS_MAC
+ self.backgroundColor = [NSColor colorWithCalibratedRed:0.569f green:0.82f blue:0.478f alpha:1.0f];
+ 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
+ //
+ self.displayLink = [EZAudioDisplayLink displayLinkWithDelegate:self];
+ [self.displayLink start];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setupPlot
+{
+ //
+ // Override in subclass
+ //
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setupOpenGL
+{
+ self.baseEffect = [[GLKBaseEffect alloc] init];
+ self.baseEffect.useConstantColor = YES;
+#if TARGET_OS_IPHONE
+ if (!self.context)
+ {
+ self.context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
+ }
+ [EAGLContext setCurrentContext:self.context];
+ self.drawableColorFormat = GLKViewDrawableColorFormatRGBA8888;
+ self.drawableDepthFormat = GLKViewDrawableDepthFormat24;
+ self.drawableStencilFormat = GLKViewDrawableStencilFormat8;
+ self.drawableMultisample = GLKViewDrawableMultisample4X;
+ self.opaque = NO;
+ self.enableSetNeedsDisplay = NO;
+#elif TARGET_OS_MAC
+ self.wantsBestResolutionOpenGLSurface = YES;
+ self.wantsLayer = YES;
+ self.layer.opaque = YES;
+ self.layer.backgroundColor = [NSColor clearColor].CGColor;
+ if (!self.pixelFormat)
+ {
+ NSOpenGLPixelFormatAttribute attrs[] =
+ {
+ NSOpenGLPFADoubleBuffer,
+ NSOpenGLPFAMultisample,
+ NSOpenGLPFASampleBuffers, 1,
+ NSOpenGLPFASamples, 4,
+ NSOpenGLPFADepthSize, 24,
+ NSOpenGLPFAOpenGLProfile,
+ NSOpenGLProfileVersion3_2Core, 0
+ };
+ self.pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attrs];
+ }
+#if DEBUG
+ NSAssert(self.pixelFormat, @"Could not create OpenGL pixel format so context is not valid");
+#endif
+ self.openGLContext = [[NSOpenGLContext alloc] initWithFormat:self.pixelFormat
+ shareContext:nil];
+ GLint swapInt = 1; GLint surfaceOpacity = 0;
+ [self.openGLContext setValues:&swapInt forParameter:NSOpenGLCPSwapInterval];
+ [self.openGLContext setValues:&surfaceOpacity forParameter:NSOpenGLCPSurfaceOpacity];
+ [self.openGLContext lock];
+ glGenVertexArrays(1, &self.info->vab);
+ glBindVertexArray(self.info->vab);
+#endif
+ glGenBuffers(1, &self.info->vbo);
+ glBindBuffer(GL_ARRAY_BUFFER, self.info->vbo);
+ glBufferData(GL_ARRAY_BUFFER,
+ self.info->pointCount * sizeof(EZAudioPlotGLPoint),
+ self.info->points,
+ GL_STREAM_DRAW);
+#if !TARGET_OS_IPHONE
+ [self.openGLContext unlock];
+#endif
+ self.frame = self.frame;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Updating The Plot
+//------------------------------------------------------------------------------
+
+- (void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize
+{
+ //
+ // Update history
+ //
+ [EZAudioUtilities appendBufferRMS:buffer
+ withBufferSize:bufferSize
+ toHistoryInfo:self.info->historyInfo];
+
+ //
+ // Convert this data to point data
+ //
+ switch (self.plotType)
+ {
+ case EZPlotTypeBuffer:
+ [self setSampleData:buffer
+ length:bufferSize];
+ break;
+ case EZPlotTypeRolling:
+ [self setSampleData:self.info->historyInfo->buffer
+ length:self.info->historyInfo->bufferSize];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setSampleData:(float *)data length:(int)length
+{
+ int pointCount = self.shouldFill ? length * 2 : length;
+ EZAudioPlotGLPoint *points = self.info->points;
+ for (int i = 0; i < length; i++)
+ {
+ if (self.shouldFill)
+ {
+ points[i * 2].x = points[i * 2 + 1].x = i;
+ points[i * 2].y = data[i];
+ points[i * 2 + 1].y = 0.0f;
+ }
+ else
+ {
+ points[i].x = i;
+ points[i].y = data[i];
+ }
+ }
+ points[0].y = points[pointCount - 1].y = 0.0f;
+ self.info->pointCount = pointCount;
+ self.info->interpolated = self.shouldFill;
+#if !TARGET_OS_IPHONE
+ [self.openGLContext lock];
+ glBindVertexArray(self.info->vab);
+#endif
+ glBindBuffer(GL_ARRAY_BUFFER, self.info->vbo);
+ glBufferSubData(GL_ARRAY_BUFFER,
+ 0,
+ pointCount * sizeof(EZAudioPlotGLPoint),
+ self.info->points);
+#if !TARGET_OS_IPHONE
+ [self.openGLContext unlock];
+#endif
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Adjusting History Resolution
+//------------------------------------------------------------------------------
+
+- (int)rollingHistoryLength
+{
+ return self.info->historyInfo->bufferSize;
+}
+
+//------------------------------------------------------------------------------
+
+- (int)setRollingHistoryLength:(int)historyLength
+{
+ self.info->historyInfo->bufferSize = MIN(EZAudioPlotDefaultMaxHistoryBufferLength, historyLength);
+ return self.info->historyInfo->bufferSize;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Clearing The Plot
+//------------------------------------------------------------------------------
+
+- (void)clear
+{
+ float emptyBuffer[1];
+ emptyBuffer[0] = 0.0f;
+ [self setSampleData:emptyBuffer length:1];
+ [EZAudioUtilities clearHistoryInfo:self.info->historyInfo];
+#if TARGET_OS_IPHONE
+ [self display];
+#elif TARGET_OS_MAC
+ [self redraw];
+#endif
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Start/Stop Display Link
+//------------------------------------------------------------------------------
+
+- (void)pauseDrawing
+{
+ [self.displayLink stop];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)resumeDrawing
+{
+ [self.displayLink start];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setBackgroundColor:(id)backgroundColor
+{
+ _backgroundColor = backgroundColor;
+ if (backgroundColor)
+ {
+ CGColorRef colorRef = [backgroundColor CGColor];
+ CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
+ [EZAudioUtilities getColorComponentsFromCGColor:colorRef
+ red:&red
+ green:&green
+ blue:&blue
+ alpha:&alpha];
+ //
+ // Note! If you set the alpha to be 0 on mac for a transparent view
+ // the EZAudioPlotGL will make the superview layer-backed to make
+ // sure there is a surface to display itself on (or else you will get
+ // some pretty weird drawing glitches
+ //
+#if !TARGET_OS_IPHONE
+ if (alpha == 0.0f)
+ {
+ [self.superview setWantsLayer:YES];
+ }
+#endif
+ glClearColor(red, green, blue, alpha);
+ }
+ else
+ {
+ glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setColor:(id)color
+{
+ _color = color;
+ if (color)
+ {
+ CGColorRef colorRef = [color CGColor];
+ CGFloat red; CGFloat green; CGFloat blue; CGFloat alpha;
+ [EZAudioUtilities getColorComponentsFromCGColor:colorRef
+ red:&red
+ green:&green
+ blue:&blue
+ alpha:&alpha];
+ self.baseEffect.constantColor = GLKVector4Make(red, green, blue, alpha);
+ }
+ else
+ {
+ self.baseEffect.constantColor = GLKVector4Make(0.0f, 0.0f, 0.0f, 0.0f);
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Drawing
+//------------------------------------------------------------------------------
+
+- (void)drawRect:(EZRect)rect
+{
+ [self redraw];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)redraw
+{
+#if !TARGET_OS_IPHONE
+ [self.openGLContext makeCurrentContext];
+ [self.openGLContext lock];
+#endif
+ [self redrawWithPoints:self.info->points
+ pointCount:self.info->pointCount
+ baseEffect:self.baseEffect
+ vertexBufferObject:self.info->vbo
+ vertexArrayBuffer:self.info->vab
+ interpolated:self.info->interpolated
+ mirrored:self.shouldMirror
+ gain:self.gain];
+#if !TARGET_OS_IPHONE
+ [self.openGLContext flushBuffer];
+ [self.openGLContext unlock];
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+- (void)redrawWithPoints:(EZAudioPlotGLPoint *)points
+ pointCount:(UInt32)pointCount
+ baseEffect:(GLKBaseEffect *)baseEffect
+ vertexBufferObject:(GLuint)vbo
+ vertexArrayBuffer:(GLuint)vab
+ interpolated:(BOOL)interpolated
+ mirrored:(BOOL)mirrored
+ gain:(float)gain
+{
+ glClear(GL_COLOR_BUFFER_BIT);
+ GLenum mode = interpolated ? GL_TRIANGLE_STRIP : GL_LINE_STRIP;
+ float interpolatedFactor = interpolated ? 2.0f : 1.0f;
+ float xscale = 2.0f / ((float)pointCount / interpolatedFactor);
+ float yscale = 1.0f * gain;
+ GLKMatrix4 transform = GLKMatrix4MakeTranslation(-1.0f, 0.0f, 0.0f);
+ transform = GLKMatrix4Scale(transform, xscale, yscale, 1.0f);
+ baseEffect.transform.modelviewMatrix = transform;
+#if !TARGET_OS_IPHONE
+ glBindVertexArray(vab);
+#endif
+ glBindBuffer(GL_ARRAY_BUFFER, vbo);
+ [baseEffect prepareToDraw];
+ glEnableVertexAttribArray(GLKVertexAttribPosition);
+ glVertexAttribPointer(GLKVertexAttribPosition,
+ 2,
+ GL_FLOAT,
+ GL_FALSE,
+ sizeof(EZAudioPlotGLPoint),
+ NULL);
+ glDrawArrays(mode, 0, pointCount);
+ if (mirrored)
+ {
+ baseEffect.transform.modelviewMatrix = GLKMatrix4Rotate(transform, M_PI, 1.0f, 0.0f, 0.0f);
+ [baseEffect prepareToDraw];
+ glDrawArrays(mode, 0, pointCount);
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+- (int)defaultRollingHistoryLength
+{
+ return EZAudioPlotDefaultHistoryBufferLength;
+}
+
+//------------------------------------------------------------------------------
+
+- (int)maximumRollingHistoryLength
+{
+ return EZAudioPlotDefaultMaxHistoryBufferLength;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioDisplayLinkDelegate
+//------------------------------------------------------------------------------
+
+- (void)displayLinkNeedsDisplay:(EZAudioDisplayLink *)displayLink
+{
+#if TARGET_OS_IPHONE
+ if ([[UIApplication sharedApplication] applicationState] == UIApplicationStateActive)
+ {
+ [self display];
+ }
+#elif TARGET_OS_MAC
+ [self redraw];
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZAudioUtilities.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+#import <TargetConditionals.h>
+#import "TPCircularBuffer.h"
+#if TARGET_OS_IPHONE
+#import <AVFoundation/AVFoundation.h>
+#elif TARGET_OS_MAC
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+/**
+ A data structure that holds information about audio data over time. It contains a circular buffer to incrementally write the audio data to and a scratch buffer to hold a window of audio data relative to the whole circular buffer. In use, this will provide a way to continuously append data while having an adjustable viewable window described by the bufferSize.
+ */
+typedef struct
+{
+ float *buffer;
+ int bufferSize;
+ TPCircularBuffer circularBuffer;
+} EZPlotHistoryInfo;
+
+//------------------------------------------------------------------------------
+
+/**
+ A data structure that holds information about a node in the context of an AUGraph.
+ */
+typedef struct
+{
+ AudioUnit audioUnit;
+ AUNode node;
+} EZAudioNodeInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - Types
+//------------------------------------------------------------------------------
+
+#if TARGET_OS_IPHONE
+typedef CGRect EZRect;
+#elif TARGET_OS_MAC
+typedef NSRect EZRect;
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioUtilities
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioUtilities class provides a set of class-level utility methods used throughout EZAudio to handle common operations such as allocating audio buffers and structures, creating various types of AudioStreamBasicDescription structures, string helpers for formatting and debugging, various math utilities, a very handy check result function (used everywhere!), and helpers for dealing with circular buffers. These were previously on the EZAudio class, but as of the 0.1.0 release have been moved here so the whole EZAudio is not needed when using only certain modules.
+ */
+@interface EZAudioUtilities : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Debugging
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Debugging EZAudio
+///-----------------------------------------------------------
+
+/**
+ Globally sets whether or not the program should exit if a `checkResult:operation:` operation fails. Currently the behavior on EZAudio is to quit if a `checkResult:operation:` fails, but this is not desirable in any production environment. Internally there are a lot of `checkResult:operation:` operations used on all the core classes. This should only ever be set to NO in production environments since a `checkResult:operation:` failing means something breaking has likely happened.
+ @param shouldExitOnCheckResultFail A BOOL indicating whether or not the running program should exist due to a `checkResult:operation:` fail.
+ */
++ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a flag indicating whether or not the program will exit if a `checkResult:operation:` fails.
+ @return A BOOL indicating whether or not the program will exit if a `checkResult:operation:` fails.
+ */
++ (BOOL)shouldExitOnCheckResultFail;
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioBufferList Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name AudioBufferList Utility
+///-----------------------------------------------------------
+
+/**
+ Allocates an AudioBufferList structure. Make sure to call freeBufferList when done using AudioBufferList or it will leak.
+ @param frames The number of frames that will be stored within each audio buffer
+ @param channels The number of channels (e.g. 2 for stereo, 1 for mono, etc.)
+ @param interleaved Whether the samples will be interleaved (if not it will be assumed to be non-interleaved and each channel will have an AudioBuffer allocated)
+ @return An AudioBufferList struct that has been allocated in memory
+ */
++ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+ interleaved:(BOOL)interleaved;
+
+//------------------------------------------------------------------------------
+
+/**
+ Allocates an array of float arrays given the number of frames needed to store in each float array.
+ @param frames A UInt32 representing the number of frames to store in each float buffer
+ @param channels A UInt32 representing the number of channels (i.e. the number of float arrays to allocate)
+ @return An array of float arrays, each the length of the number of frames specified
+ */
++ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels;
+
+//------------------------------------------------------------------------------
+
+/**
+ Deallocates an AudioBufferList structure from memory.
+ @param bufferList A pointer to the buffer list you would like to free
+ */
++ (void)freeBufferList:(AudioBufferList *)bufferList;
+
+//------------------------------------------------------------------------------
+
+/**
+ Deallocates an array of float buffers
+ @param buffers An array of float arrays
+ @param channels A UInt32 representing the number of channels (i.e. the number of float arrays to deallocate)
+ */
++ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels;
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioStreamBasicDescription Utilties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Creating An AudioStreamBasicDescription
+///-----------------------------------------------------------
+
+/**
+ Creates a signed-integer, interleaved AudioStreamBasicDescription for the number of channels specified for an AIFF format.
+ @param channels The desired number of channels
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an AudioStreamBasicDescription for the iLBC narrow band speech codec.
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a float-based, non-interleaved AudioStreamBasicDescription for the number of channels specified.
+ @param channels A UInt32 representing the number of channels.
+ @param sampleRate A float representing the sample rate.
+ @return A float-based AudioStreamBasicDescription with the number of channels specified.
+ */
++ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an AudioStreamBasicDescription for an M4A AAC format.
+ @param channels The desired number of channels
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a single-channel, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a single-channel, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `monoFloatFormatWithSampleRate:`).
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription (as of 0.0.6 this is the same as `stereoFloatNonInterleavedFormatWithSampleRate:`).
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, interleaved, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a two-channel, non-interleaved, float-based AudioStreamBasicDescription.
+ @param sampleRate A float representing the sample rate.
+ @return A new AudioStreamBasicDescription with the specified format.
+ */
++ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate;
+
+//------------------------------------------------------------------------------
+// @name AudioStreamBasicDescription Helper Functions
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to see if it is a float-based format (as opposed to a signed integer based format).
+ @param asbd A valid AudioStreamBasicDescription
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is a float format.
+ */
++ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd;
+
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to check for an interleaved flag (samples are
+ stored in one buffer one after another instead of two (or n channels) parallel buffers
+ @param asbd A valid AudioStreamBasicDescription
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is interleaved
+ */
++ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd;
+
+//------------------------------------------------------------------------------
+
+/**
+ Checks an AudioStreamBasicDescription to see if it is a linear PCM format (uncompressed,
+ 1 frame per packet)
+ @param asbd A valid AudioStreamBasicDescription
+ @return A BOOL indicating whether or not the AudioStreamBasicDescription is linear PCM.
+ */
++ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd;
+
+///-----------------------------------------------------------
+/// @name AudioStreamBasicDescription Utilities
+///-----------------------------------------------------------
+
+/**
+ Nicely logs out the contents of an AudioStreamBasicDescription struct
+ @param asbd The AudioStreamBasicDescription struct with content to print out
+ */
++ (void)printASBD:(AudioStreamBasicDescription)asbd;
+
+//------------------------------------------------------------------------------
+
+/**
+ Converts seconds into a string formatted as MM:SS
+ @param seconds An NSTimeInterval representing the number of seconds
+ @return An NSString instance formatted as MM:SS from the seconds provided.
+ */
++ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a string to use when logging out the contents of an AudioStreamBasicDescription
+ @param asbd A valid AudioStreamBasicDescription struct.
+ @return An NSString representing the contents of the AudioStreamBasicDescription.
+ */
++ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
+
+//------------------------------------------------------------------------------
+
+/**
+ Just a wrapper around the setCanonical function provided in the Core Audio Utility C++ class.
+ @param asbd The AudioStreamBasicDescription structure to modify
+ @param nChannels The number of expected channels on the description
+ @param interleaved A flag indicating whether the stereo samples should be interleaved in the buffer
+ */
++ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
+ numberOfChannels:(UInt32)nChannels
+ interleaved:(BOOL)interleaved;
+
+//------------------------------------------------------------------------------
+#pragma mark - Math Utilities
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Math Utilities
+///-----------------------------------------------------------
+
+/**
+ Appends an array of values to a history buffer and performs an internal shift to add the values to the tail and removes the same number of values from the head.
+ @param buffer A float array of values to append to the tail of the history buffer
+ @param bufferLength The length of the float array being appended to the history buffer
+ @param scrollHistory The target history buffer in which to append the values
+ @param scrollHistoryLength The length of the target history buffer
+ */
++ (void)appendBufferAndShift:(float*)buffer
+ withBufferSize:(int)bufferLength
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Appends a value to a history buffer and performs an internal shift to add the value to the tail and remove the 0th value.
+ @param value The float value to append to the history array
+ @param scrollHistory The target history buffer in which to append the values
+ @param scrollHistoryLength The length of the target history buffer
+ */
++(void) appendValue:(float)value
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength;
+
+//------------------------------------------------------------------------------
+
+/**
+ Maps a value from one coordinate system into another one. Takes in the current value to map, the minimum and maximum values of the first coordinate system, and the minimum and maximum values of the second coordinate system and calculates the mapped value in the second coordinate system's constraints.
+ @param value The value expressed in the first coordinate system
+ @param leftMin The minimum of the first coordinate system
+ @param leftMax The maximum of the first coordinate system
+ @param rightMin The minimum of the second coordindate system
+ @param rightMax The maximum of the second coordinate system
+ @return The mapped value in terms of the second coordinate system
+ */
++ (float)MAP:(float)value
+ leftMin:(float)leftMin
+ leftMax:(float)leftMax
+ rightMin:(float)rightMin
+ rightMax:(float)rightMax;
+
+//------------------------------------------------------------------------------
+
+/**
+ Calculates the root mean squared for a buffer.
+ @param buffer A float buffer array of values whose root mean squared to calculate
+ @param bufferSize The size of the float buffer
+ @return The root mean squared of the buffer
+ */
++ (float)RMS:(float*)buffer length:(int)bufferSize;
+
+//------------------------------------------------------------------------------
+
+/**
+ Calculate the sign function sgn(x) =
+ { -1 , x < 0,
+ { 0 , x = 0,
+ { 1 , x > 0
+ @param value The float value for which to use as x
+ @return The float sign value
+ */
++ (float)SGN:(float)value;
+
+//------------------------------------------------------------------------------
+#pragma mark - Music Utilities
+//------------------------------------------------------------------------------
+
++ (NSString *)noteNameStringForFrequency:(float)frequency
+ includeOctave:(BOOL)includeOctave;
+
+//------------------------------------------------------------------------------
+#pragma mark - OSStatus Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name OSStatus Utility
+///-----------------------------------------------------------
+
+/**
+ Basic check result function useful for checking each step of the audio setup process
+ @param result The OSStatus representing the result of an operation
+ @param operation A string (const char, not NSString) describing the operation taking place (will print if fails)
+ */
++ (void)checkResult:(OSStatus)result operation:(const char *)operation;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a string representation of the often cryptic Core Audio error codes
+ @param code A UInt32 representing an error code
+ @return An NSString with a human readable version of the error code.
+ */
++ (NSString *)stringFromUInt32Code:(UInt32)code;
+
+//------------------------------------------------------------------------------
+#pragma mark - Color Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Color Utility
+///-----------------------------------------------------------
+
+/**
+ Helper function to get the color components from a CGColorRef in the RGBA colorspace.
+ @param color A CGColorRef that represents a color.
+ @param red A pointer to a CGFloat to hold the value of the red component. This value will be between 0 and 1.
+ @param green A pointer to a CGFloat to hold the value of the green component. This value will be between 0 and 1.
+ @param blue A pointer to a CGFloat to hold the value of the blue component. This value will be between 0 and 1.
+ @param alpha A pointer to a CGFloat to hold the value of the alpha component. This value will be between 0 and 1.
+ */
++ (void)getColorComponentsFromCGColor:(CGColorRef)color
+ red:(CGFloat *)red
+ green:(CGFloat *)green
+ blue:(CGFloat *)blue
+ alpha:(CGFloat *)alpha;
+
+//------------------------------------------------------------------------------
+#pragma mark - Plot Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Plot Utility
+///-----------------------------------------------------------
+
+/**
+ Given a buffer representing a window of float history data this append the RMS of a buffer of incoming float data...This will likely be deprecated in a future version of EZAudio for a circular buffer based approach.
+ @param scrollHistory An array of float arrays being used to hold the history values for each channel.
+ @param scrollHistoryLength An int representing the length of the history window.
+ @param index An int pointer to the index of the current read index of the history buffer.
+ @param buffer A float array representing the incoming audio data.
+ @param bufferSize An int representing the length of the incoming audio data.
+ @param isChanging A BOOL pointer representing whether the resolution (length of the history window) is currently changing.
+ */
++ (void)updateScrollHistory:(float **)scrollHistory
+ withLength:(int)scrollHistoryLength
+ atIndex:(int *)index
+ withBuffer:(float *)buffer
+ withBufferSize:(int)bufferSize
+ isResolutionChanging:(BOOL *)isChanging;
+
+//------------------------------------------------------------------------------
+#pragma mark - TPCircularBuffer Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name TPCircularBuffer Utility
+///-----------------------------------------------------------
+
+/**
+ Appends the data from the audio buffer list to the circular buffer
+ @param circularBuffer Pointer to the instance of the TPCircularBuffer to add the audio data to
+ @param audioBufferList Pointer to the instance of the AudioBufferList with the audio data
+ */
++ (void)appendDataToCircularBuffer:(TPCircularBuffer*)circularBuffer
+ fromAudioBufferList:(AudioBufferList*)audioBufferList;
+
+//------------------------------------------------------------------------------
+
+/**
+ Initializes the circular buffer (just a wrapper around the C method)
+ @param circularBuffer Pointer to an instance of the TPCircularBuffer
+ @param size The length of the TPCircularBuffer (usually 1024)
+ */
++ (void)circularBuffer:(TPCircularBuffer*)circularBuffer
+ withSize:(int)size;
+
+//------------------------------------------------------------------------------
+
+/**
+ Frees a circular buffer
+ @param circularBuffer Pointer to the circular buffer to clear
+ */
++ (void)freeCircularBuffer:(TPCircularBuffer*)circularBuffer;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZPlotHistoryInfo Utility
+//------------------------------------------------------------------------------
+
+/**
+ Calculates the RMS of a float array containing audio data and appends it to the tail of a EZPlotHistoryInfo data structure. Thread-safe.
+ @param buffer A float array containing the incoming audio buffer to append to the history buffer
+ @param bufferSize A UInt32 representing the length of the incoming audio buffer
+ @param historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers
+ */
++ (void)appendBufferRMS:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+ toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
+
+//------------------------------------------------------------------------------
+
+/**
+ Appends a buffer of audio data to the tail of a EZPlotHistoryInfo data structure. Thread-safe.
+ @param buffer A float array containing the incoming audio buffer to append to the history buffer
+ @param bufferSize A UInt32 representing the length of the incoming audio buffer
+ @param historyInfo A pointer to a EZPlotHistoryInfo structure to use for managing the history buffers
+ */
++ (void)appendBuffer:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+ toHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
+
+//------------------------------------------------------------------------------
+
+/**
+ Zeroes out a EZPlotHistoryInfo data structure without freeing the resources.
+ @param historyInfo A pointer to a EZPlotHistoryInfo data structure
+ */
++ (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
+
+//------------------------------------------------------------------------------
+
+/**
+ Frees a EZPlotHistoryInfo data structure
+ @param historyInfo A pointer to a EZPlotHistoryInfo data structure
+ */
++ (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an EZPlotHistoryInfo data structure with a default length for the window buffer and a maximum length capacity for the internal circular buffer that holds all the audio data.
+ @param defaultLength An int representing the default length (i.e. the number of points that will be displayed on screen) of the history window.
+ @param maximumLength An int representing the default maximum length that is the absolute maximum amount of values that can be held in the history's circular buffer.
+ @return A pointer to the EZPlotHistoryInfo created. The caller is responsible for freeing this structure using the `freeHistoryInfo` method above.
+ */
++ (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
+ maximumLength:(int)maximumLength;
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioUtilities.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 6/23/15.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZAudioUtilities.h"
+
+static float const EZAudioUtilitiesFixedNoteA = 440.0f;
+static int const EZAudioUtilitiesFixedNoteAIndex = 9;
+static int const EZAudioUtilitiesFixedNoteAOctave = 4;
+static float const EZAudioUtilitiesEQFrequencyRatio = 1.059463094359f;
+static int const EZAudioUtilitiesNotesLength = 12;
+static NSString * const EZAudioUtilitiesNotes[EZAudioUtilitiesNotesLength] =
+{
+ @"C", @"C#",
+ @"D", @"D#",
+ @"E",
+ @"F", @"F#",
+ @"G", @"G#",
+ @"A", @"A#",
+ @"B"
+};
+
+BOOL __shouldExitOnCheckResultFail = YES;
+
+@implementation EZAudioUtilities
+
+//------------------------------------------------------------------------------
+#pragma mark - Debugging
+//------------------------------------------------------------------------------
+
++ (void)setShouldExitOnCheckResultFail:(BOOL)shouldExitOnCheckResultFail
+{
+ __shouldExitOnCheckResultFail = shouldExitOnCheckResultFail;
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)shouldExitOnCheckResultFail
+{
+ return __shouldExitOnCheckResultFail;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioBufferList Utility
+//------------------------------------------------------------------------------
+
++ (AudioBufferList *)audioBufferListWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+ interleaved:(BOOL)interleaved
+{
+ unsigned nBuffers;
+ unsigned bufferSize;
+ unsigned channelsPerBuffer;
+ if (interleaved)
+ {
+ nBuffers = 1;
+ bufferSize = sizeof(float) * frames * channels;
+ channelsPerBuffer = channels;
+ }
+ else
+ {
+ nBuffers = channels;
+ bufferSize = sizeof(float) * frames;
+ channelsPerBuffer = 1;
+ }
+
+ AudioBufferList *audioBufferList = (AudioBufferList *)malloc(sizeof(AudioBufferList) + sizeof(AudioBuffer) * (channels-1));
+ audioBufferList->mNumberBuffers = nBuffers;
+ for(unsigned i = 0; i < nBuffers; i++)
+ {
+ audioBufferList->mBuffers[i].mNumberChannels = channelsPerBuffer;
+ audioBufferList->mBuffers[i].mDataByteSize = bufferSize;
+ audioBufferList->mBuffers[i].mData = calloc(bufferSize, 1);
+ }
+ return audioBufferList;
+}
+
+//------------------------------------------------------------------------------
+
++ (float **)floatBuffersWithNumberOfFrames:(UInt32)frames
+ numberOfChannels:(UInt32)channels
+{
+ size_t size = sizeof(float *) * channels;
+ float **buffers = (float **)malloc(size);
+ for (int i = 0; i < channels; i++)
+ {
+ size = sizeof(float) * frames;
+ buffers[i] = (float *)malloc(size);
+ }
+ return buffers;
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeBufferList:(AudioBufferList *)bufferList
+{
+ if (bufferList)
+ {
+ if (bufferList->mNumberBuffers)
+ {
+ for( int i = 0; i < bufferList->mNumberBuffers; i++)
+ {
+ if (bufferList->mBuffers[i].mData)
+ {
+ free(bufferList->mBuffers[i].mData);
+ }
+ }
+ }
+ free(bufferList);
+ }
+ bufferList = NULL;
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeFloatBuffers:(float **)buffers numberOfChannels:(UInt32)channels
+{
+ if (!buffers || !*buffers)
+ {
+ return;
+ }
+
+ for (int i = 0; i < channels; i++)
+ {
+ free(buffers[i]);
+ }
+ free(buffers);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - AudioStreamBasicDescription Utility
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)AIFFFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ memset(&asbd, 0, sizeof(asbd));
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFormatFlags = kAudioFormatFlagIsBigEndian|kAudioFormatFlagIsPacked|kAudioFormatFlagIsSignedInteger;
+ asbd.mSampleRate = sampleRate;
+ asbd.mChannelsPerFrame = channels;
+ asbd.mBitsPerChannel = 32;
+ asbd.mBytesPerPacket = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
+ asbd.mFramesPerPacket = 1;
+ asbd.mBytesPerFrame = (asbd.mBitsPerChannel / 8) * asbd.mChannelsPerFrame;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)iLBCFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ memset(&asbd, 0, sizeof(asbd));
+ asbd.mFormatID = kAudioFormatiLBC;
+ asbd.mChannelsPerFrame = 1;
+ asbd.mSampleRate = sampleRate;
+
+ // Fill in the rest of the descriptions using the Audio Format API
+ UInt32 propSize = sizeof(asbd);
+ [EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
+ 0,
+ NULL,
+ &propSize,
+ &asbd)
+ operation:"Failed to fill out the rest of the iLBC AudioStreamBasicDescription"];
+
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)floatFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 floatByteSize = sizeof(float);
+ asbd.mBitsPerChannel = 8 * floatByteSize;
+ asbd.mBytesPerFrame = floatByteSize;
+ asbd.mBytesPerPacket = floatByteSize;
+ asbd.mChannelsPerFrame = channels;
+ asbd.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsNonInterleaved;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFramesPerPacket = 1;
+ asbd.mSampleRate = sampleRate;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)M4AFormatWithNumberOfChannels:(UInt32)channels
+ sampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ memset(&asbd, 0, sizeof(asbd));
+ asbd.mFormatID = kAudioFormatMPEG4AAC;
+ asbd.mChannelsPerFrame = channels;
+ asbd.mSampleRate = sampleRate;
+
+ // Fill in the rest of the descriptions using the Audio Format API
+ UInt32 propSize = sizeof(asbd);
+ [EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
+ 0,
+ NULL,
+ &propSize,
+ &asbd)
+ operation:"Failed to fill out the rest of the m4a AudioStreamBasicDescription"];
+
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)monoFloatFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 byteSize = sizeof(float);
+ asbd.mBitsPerChannel = 8 * byteSize;
+ asbd.mBytesPerFrame = byteSize;
+ asbd.mBytesPerPacket = byteSize;
+ asbd.mChannelsPerFrame = 1;
+ asbd.mFormatFlags = kAudioFormatFlagIsPacked|kAudioFormatFlagIsFloat;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFramesPerPacket = 1;
+ asbd.mSampleRate = sampleRate;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)monoCanonicalFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 byteSize = sizeof(float);
+ asbd.mBitsPerChannel = 8 * byteSize;
+ asbd.mBytesPerFrame = byteSize;
+ asbd.mBytesPerPacket = byteSize;
+ asbd.mChannelsPerFrame = 1;
+ asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFramesPerPacket = 1;
+ asbd.mSampleRate = sampleRate;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoCanonicalNonInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 byteSize = sizeof(float);
+ asbd.mBitsPerChannel = 8 * byteSize;
+ asbd.mBytesPerFrame = byteSize;
+ asbd.mBytesPerPacket = byteSize;
+ asbd.mChannelsPerFrame = 2;
+ asbd.mFormatFlags = kAudioFormatFlagsNativeFloatPacked|kAudioFormatFlagIsNonInterleaved;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFramesPerPacket = 1;
+ asbd.mSampleRate = sampleRate;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoFloatInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 floatByteSize = sizeof(float);
+ asbd.mChannelsPerFrame = 2;
+ asbd.mBitsPerChannel = 8 * floatByteSize;
+ asbd.mBytesPerFrame = asbd.mChannelsPerFrame * floatByteSize;
+ asbd.mFramesPerPacket = 1;
+ asbd.mBytesPerPacket = asbd.mFramesPerPacket * asbd.mBytesPerFrame;
+ asbd.mFormatFlags = kAudioFormatFlagIsFloat;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mSampleRate = sampleRate;
+ asbd.mReserved = 0;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)stereoFloatNonInterleavedFormatWithSampleRate:(float)sampleRate
+{
+ AudioStreamBasicDescription asbd;
+ UInt32 floatByteSize = sizeof(float);
+ asbd.mBitsPerChannel = 8 * floatByteSize;
+ asbd.mBytesPerFrame = floatByteSize;
+ asbd.mChannelsPerFrame = 2;
+ asbd.mFormatFlags = kAudioFormatFlagIsFloat|kAudioFormatFlagIsNonInterleaved;
+ asbd.mFormatID = kAudioFormatLinearPCM;
+ asbd.mFramesPerPacket = 1;
+ asbd.mBytesPerPacket = asbd.mFramesPerPacket * asbd.mBytesPerFrame;
+ asbd.mSampleRate = sampleRate;
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isFloatFormat:(AudioStreamBasicDescription)asbd
+{
+ return asbd.mFormatFlags & kAudioFormatFlagIsFloat;
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isInterleaved:(AudioStreamBasicDescription)asbd
+{
+ return !(asbd.mFormatFlags & kAudioFormatFlagIsNonInterleaved);
+}
+
+//------------------------------------------------------------------------------
+
++ (BOOL)isLinearPCM:(AudioStreamBasicDescription)asbd
+{
+ return asbd.mFormatID == kAudioFormatLinearPCM;
+}
+
+//------------------------------------------------------------------------------
+
++ (void)printASBD:(AudioStreamBasicDescription)asbd
+{
+ char formatIDString[5];
+ UInt32 formatID = CFSwapInt32HostToBig(asbd.mFormatID);
+ bcopy (&formatID, formatIDString, 4);
+ formatIDString[4] = '\0';
+ NSLog (@" Sample Rate: %10.0f", asbd.mSampleRate);
+ NSLog (@" Format ID: %10s", formatIDString);
+ NSLog (@" Format Flags: %10X", (unsigned int)asbd.mFormatFlags);
+ NSLog (@" Bytes per Packet: %10d", (unsigned int)asbd.mBytesPerPacket);
+ NSLog (@" Frames per Packet: %10d", (unsigned int)asbd.mFramesPerPacket);
+ NSLog (@" Bytes per Frame: %10d", (unsigned int)asbd.mBytesPerFrame);
+ NSLog (@" Channels per Frame: %10d", (unsigned int)asbd.mChannelsPerFrame);
+ NSLog (@" Bits per Channel: %10d", (unsigned int)asbd.mBitsPerChannel);
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)displayTimeStringFromSeconds:(NSTimeInterval)seconds
+{
+ int totalSeconds = (int)ceil(seconds);
+ int secondsComponent = totalSeconds % 60;
+ int minutesComponent = (totalSeconds / 60) % 60;
+ return [NSString stringWithFormat:@"%02d:%02d", minutesComponent, secondsComponent];
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)stringForAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd
+{
+ char formatIDString[5];
+ UInt32 formatID = CFSwapInt32HostToBig(asbd.mFormatID);
+ bcopy (&formatID, formatIDString, 4);
+ formatIDString[4] = '\0';
+ return [NSString stringWithFormat:
+ @"\nSample Rate: %10.0f,\n"
+ @"Format ID: %10s,\n"
+ @"Format Flags: %10X,\n"
+ @"Bytes per Packet: %10d,\n"
+ @"Frames per Packet: %10d,\n"
+ @"Bytes per Frame: %10d,\n"
+ @"Channels per Frame: %10d,\n"
+ @"Bits per Channel: %10d,\n"
+ @"IsInterleaved: %i,\n"
+ @"IsFloat: %i,",
+ asbd.mSampleRate,
+ formatIDString,
+ (unsigned int)asbd.mFormatFlags,
+ (unsigned int)asbd.mBytesPerPacket,
+ (unsigned int)asbd.mFramesPerPacket,
+ (unsigned int)asbd.mBytesPerFrame,
+ (unsigned int)asbd.mChannelsPerFrame,
+ (unsigned int)asbd.mBitsPerChannel,
+ [self isInterleaved:asbd],
+ [self isFloatFormat:asbd]];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)setCanonicalAudioStreamBasicDescription:(AudioStreamBasicDescription*)asbd
+ numberOfChannels:(UInt32)nChannels
+ interleaved:(BOOL)interleaved
+{
+
+ asbd->mFormatID = kAudioFormatLinearPCM;
+#if TARGET_OS_IPHONE
+ int sampleSize = sizeof(float);
+ asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+#elif TARGET_OS_MAC
+ int sampleSize = sizeof(Float32);
+ asbd->mFormatFlags = kAudioFormatFlagsNativeFloatPacked;
+#endif
+ asbd->mBitsPerChannel = 8 * sampleSize;
+ asbd->mChannelsPerFrame = nChannels;
+ asbd->mFramesPerPacket = 1;
+ if (interleaved)
+ asbd->mBytesPerPacket = asbd->mBytesPerFrame = nChannels * sampleSize;
+ else {
+ asbd->mBytesPerPacket = asbd->mBytesPerFrame = sampleSize;
+ asbd->mFormatFlags |= kAudioFormatFlagIsNonInterleaved;
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Math Utilities
+//------------------------------------------------------------------------------
+
++ (void)appendBufferAndShift:(float*)buffer
+ withBufferSize:(int)bufferLength
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength
+{
+ int shiftLength = scrollHistoryLength - bufferLength;
+ size_t floatByteSize = sizeof(float);
+ size_t shiftByteSize = shiftLength * floatByteSize;
+ size_t bufferByteSize = bufferLength * floatByteSize;
+ memmove(&scrollHistory[0],
+ &scrollHistory[bufferLength],
+ shiftByteSize);
+ memmove(&scrollHistory[shiftLength],
+ &buffer[0],
+ bufferByteSize);
+}
+
+//------------------------------------------------------------------------------
+
++ (void) appendValue:(float)value
+ toScrollHistory:(float*)scrollHistory
+ withScrollHistorySize:(int)scrollHistoryLength
+{
+ float val[1]; val[0] = value;
+ [self appendBufferAndShift:val
+ withBufferSize:1
+ toScrollHistory:scrollHistory
+ withScrollHistorySize:scrollHistoryLength];
+}
+
+//------------------------------------------------------------------------------
+
++ (float)MAP:(float)value
+ leftMin:(float)leftMin
+ leftMax:(float)leftMax
+ rightMin:(float)rightMin
+ rightMax:(float)rightMax
+{
+ float leftSpan = leftMax - leftMin;
+ float rightSpan = rightMax - rightMin;
+ float valueScaled = ( value - leftMin) / leftSpan;
+ return rightMin + (valueScaled * rightSpan);
+}
+
+//------------------------------------------------------------------------------
+
++ (float)RMS:(float *)buffer length:(int)bufferSize
+{
+ float sum = 0.0;
+ for(int i = 0; i < bufferSize; i++)
+ sum += buffer[i] * buffer[i];
+ return sqrtf( sum / bufferSize);
+}
+
+//------------------------------------------------------------------------------
+
++ (float)SGN:(float)value
+{
+ return value < 0 ? -1.0f : ( value > 0 ? 1.0f : 0.0f);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Music Utilities
+//------------------------------------------------------------------------------
+
++ (NSString *)noteNameStringForFrequency:(float)frequency
+ includeOctave:(BOOL)includeOctave
+{
+ NSMutableString *noteName = [NSMutableString string];
+ int halfStepsFromFixedNote = roundf(log(frequency / EZAudioUtilitiesFixedNoteA) / log(EZAudioUtilitiesEQFrequencyRatio));
+ int halfStepsModOctaves = halfStepsFromFixedNote % EZAudioUtilitiesNotesLength;
+ int indexOfNote = EZAudioUtilitiesFixedNoteAIndex + halfStepsModOctaves;
+ float octaves = halfStepsFromFixedNote / EZAudioUtilitiesNotesLength;
+ if (indexOfNote >= EZAudioUtilitiesNotesLength)
+ {
+ indexOfNote -= EZAudioUtilitiesNotesLength;
+ octaves += 1;
+ }
+ else if (indexOfNote < 0)
+ {
+ indexOfNote += EZAudioUtilitiesNotesLength;
+ octaves = -1;
+ }
+ [noteName appendString:EZAudioUtilitiesNotes[indexOfNote]];
+ if (includeOctave)
+ {
+ int noteOctave = EZAudioUtilitiesFixedNoteAOctave + octaves;
+ [noteName appendFormat:@"%i", noteOctave];
+ }
+ return noteName;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - OSStatus Utility
+//------------------------------------------------------------------------------
+
++ (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
+ // no, format it as an integer
+ sprintf(errorString, "%d", (int)result);
+ fprintf(stderr, "Error: %s (%s)\n", operation, errorString);
+ if (__shouldExitOnCheckResultFail)
+ {
+ exit(-1);
+ }
+}
+
+//------------------------------------------------------------------------------
+
++ (NSString *)stringFromUInt32Code:(UInt32)code
+{
+ char errorString[20];
+ // see if it appears to be a 4-char-code
+ *(UInt32 *)(errorString + 1) = CFSwapInt32HostToBig(code);
+ if (isprint(errorString[1]) &&
+ isprint(errorString[2]) &&
+ isprint(errorString[3]) &&
+ isprint(errorString[4]))
+ {
+ errorString[0] = errorString[5] = '\'';
+ errorString[6] = '\0';
+ }
+ return [NSString stringWithUTF8String:errorString];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Plot Utility
+//------------------------------------------------------------------------------
+
++ (void)updateScrollHistory:(float **)scrollHistory
+ withLength:(int)scrollHistoryLength
+ atIndex:(int *)index
+ withBuffer:(float *)buffer
+ withBufferSize:(int)bufferSize
+ isResolutionChanging:(BOOL *)isChanging
+{
+ //
+ size_t floatByteSize = sizeof(float);
+ if(*scrollHistory == NULL)
+ {
+ // Create the history buffer
+ *scrollHistory = (float *)calloc(8192, floatByteSize);
+ }
+
+ //
+ if(!*isChanging)
+ {
+ float rms = [EZAudioUtilities RMS:buffer length:bufferSize];
+ if(*index < scrollHistoryLength)
+ {
+ float *hist = *scrollHistory;
+ hist[*index] = rms;
+ (*index)++;
+ }
+ else
+ {
+ [EZAudioUtilities appendValue:rms
+ toScrollHistory:*scrollHistory
+ withScrollHistorySize:scrollHistoryLength];
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Color Utility
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Color Utility
+///-----------------------------------------------------------
+
++ (void)getColorComponentsFromCGColor:(CGColorRef)color
+ red:(CGFloat *)red
+ green:(CGFloat *)green
+ blue:(CGFloat *)blue
+ alpha:(CGFloat *)alpha
+{
+ size_t componentCount = CGColorGetNumberOfComponents(color);
+ if (componentCount == 4)
+ {
+ const CGFloat *components = CGColorGetComponents(color);
+ *red = components[0];
+ *green = components[1];
+ *blue = components[2];
+ *alpha = components[3];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - TPCircularBuffer Utility
+//------------------------------------------------------------------------------
+
++ (void)appendDataToCircularBuffer:(TPCircularBuffer *)circularBuffer
+ fromAudioBufferList:(AudioBufferList *)audioBufferList
+{
+ TPCircularBufferProduceBytes(circularBuffer,
+ audioBufferList->mBuffers[0].mData,
+ audioBufferList->mBuffers[0].mDataByteSize);
+}
+
+//------------------------------------------------------------------------------
+
++ (void)circularBuffer:(TPCircularBuffer *)circularBuffer withSize:(int)size
+{
+ TPCircularBufferInit(circularBuffer, size);
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeCircularBuffer:(TPCircularBuffer *)circularBuffer
+{
+ TPCircularBufferClear(circularBuffer);
+ TPCircularBufferCleanup(circularBuffer);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZPlotHistoryInfo Utility
+//------------------------------------------------------------------------------
+
++ (void)appendBufferRMS:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+ toHistoryInfo:(EZPlotHistoryInfo *)historyInfo
+{
+ //
+ // Calculate RMS and append to buffer
+ //
+ float rms = [EZAudioUtilities RMS:buffer length:bufferSize];
+ float src[1];
+ src[0] = isnan(rms) ? 0.0 : rms;
+ [self appendBuffer:src withBufferSize:1 toHistoryInfo:historyInfo];
+}
+
+//------------------------------------------------------------------------------
+
++ (void)appendBuffer:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+ toHistoryInfo:(EZPlotHistoryInfo *)historyInfo
+{
+ //
+ // Do nothing if there is no buffer
+ //
+ if (bufferSize == 0)
+ {
+ return;
+ }
+
+ //
+ // Update the scroll history datasource
+ //
+ TPCircularBufferProduceBytes(&historyInfo->circularBuffer, buffer, bufferSize * sizeof(float));
+ int32_t targetBytes = historyInfo->bufferSize * sizeof(float);
+ int32_t availableBytes = 0;
+ float *historyBuffer = TPCircularBufferTail(&historyInfo->circularBuffer, &availableBytes);
+ int32_t bytes = MIN(targetBytes, availableBytes);
+ memmove(historyInfo->buffer, historyBuffer, bytes);
+ if (targetBytes <= availableBytes)
+ {
+ TPCircularBufferConsume(&historyInfo->circularBuffer, availableBytes - targetBytes);
+ }
+}
+
+//------------------------------------------------------------------------------
+
++ (void)clearHistoryInfo:(EZPlotHistoryInfo *)historyInfo
+{
+ memset(historyInfo->buffer, 0, historyInfo->bufferSize * sizeof(float));
+ TPCircularBufferClear(&historyInfo->circularBuffer);
+}
+
+//------------------------------------------------------------------------------
+
++ (void)freeHistoryInfo:(EZPlotHistoryInfo *)historyInfo
+{
+ free(historyInfo->buffer);
+ free(historyInfo);
+ TPCircularBufferCleanup(&historyInfo->circularBuffer);
+}
+
+//------------------------------------------------------------------------------
+
++ (EZPlotHistoryInfo *)historyInfoWithDefaultLength:(int)defaultLength
+ maximumLength:(int)maximumLength
+{
+ //
+ // Setup buffers
+ //
+ EZPlotHistoryInfo *historyInfo = (EZPlotHistoryInfo *)malloc(sizeof(EZPlotHistoryInfo));
+ historyInfo->bufferSize = defaultLength;
+ historyInfo->buffer = calloc(maximumLength, sizeof(float));
+ TPCircularBufferInit(&historyInfo->circularBuffer, maximumLength);
+
+ //
+ // Zero out circular buffer
+ //
+ float emptyBuffer[maximumLength];
+ memset(emptyBuffer, 0, sizeof(emptyBuffer));
+ TPCircularBufferProduceBytes(&historyInfo->circularBuffer,
+ emptyBuffer,
+ (int32_t)sizeof(emptyBuffer));
+
+ return historyInfo;
+}
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZAudioiOS.m
+// EZAudio
+//
+// Created by Tommaso Piazza on 30/09/15.
+// Copyright © 2015 Andrew Breckenridge. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <EZAudioiOS/EZAudio.h>
--- /dev/null
+//
+// EZMicrophone.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 9/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+#import "TargetConditionals.h"
+#import "EZAudioDevice.h"
+#import "EZOutput.h"
+
+@class EZMicrophone;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZMicrophoneDelegate for the EZMicrophone provides a receiver for the incoming audio data events. When the microphone has been successfully internally configured it will try to send its delegate an AudioStreamBasicDescription describing the format of the incoming audio data.
+
+ The audio data itself is sent back to the delegate in various forms:
+
+ -`microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:`
+ Provides float arrays instead of the AudioBufferList structure to hold the audio data. There could be a number of float arrays depending on the number of channels (see the function description below). These are useful for doing any visualizations that would like to make use of the raw audio data.
+
+ -`microphone:hasBufferList:withBufferSize:withNumberOfChannels:`
+ Provides the AudioBufferList structures holding the audio data. These are the native structures Core Audio uses to hold the buffer information and useful for piping out directly to an output (see EZOutput).
+
+ */
+@protocol EZMicrophoneDelegate <NSObject>
+
+@optional
+///-----------------------------------------------------------
+/// @name Audio Data Description
+///-----------------------------------------------------------
+
+/**
+ Called anytime the EZMicrophone starts or stops.
+ @param output The instance of the EZMicrophone that triggered the event.
+ @param isPlaying A BOOL indicating whether the EZMicrophone instance is playing or not.
+ */
+- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying;
+
+//------------------------------------------------------------------------------
+
+/**
+ Called anytime the input device changes on an `EZMicrophone` instance.
+ @param microphone The instance of the EZMicrophone that triggered the event.
+ @param device The instance of the new EZAudioDevice the microphone is using to pull input.
+ */
+- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device;
+
+//------------------------------------------------------------------------------
+
+/**
+ Returns back the audio stream basic description as soon as it has been initialized. This is guaranteed to occur before the stream callbacks, `microphone:hasBufferList:withBufferSize:withNumberOfChannels:` or `microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:`
+ @param microphone The instance of the EZMicrophone that triggered the event.
+ @param audioStreamBasicDescription The AudioStreamBasicDescription that was created for the microphone instance.
+ */
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
+
+///-----------------------------------------------------------
+/// @name Audio Data Callbacks
+///-----------------------------------------------------------
+
+/**
+ This method provides an array of float arrays of the audio received, each float array representing a channel of audio data This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
+ @param microphone The instance of the EZMicrophone that triggered the event.
+ @param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
+ @param bufferSize The size of each of the buffers (the length of each float array).
+ @param numberOfChannels The number of channels for the incoming audio.
+ @warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
+ */
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels;
+
+//------------------------------------------------------------------------------
+
+/**
+ Returns back the buffer list containing the audio received. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
+ @param microphone The instance of the EZMicrophone that triggered the event.
+ @param bufferList The AudioBufferList holding the audio data.
+ @param bufferSize The size of each of the buffers of the AudioBufferList.
+ @param numberOfChannels The number of channels for the incoming audio.
+ @warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
+ */
+- (void) microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophone
+//------------------------------------------------------------------------------
+
+/**
+ The EZMicrophone provides a component to get audio data from the default device microphone. On OSX this is the default selected input device in the system preferences while on iOS this defaults to use the default RemoteIO audio unit. The microphone data is converted to a float buffer array and returned back to the caller via the EZMicrophoneDelegate protocol.
+ */
+@interface EZMicrophone : NSObject <EZOutputDataSource>
+
+//------------------------------------------------------------------------------
+
+/**
+ The EZMicrophoneDelegate for which to handle the microphone callbacks
+ */
+@property (nonatomic, weak) id<EZMicrophoneDelegate> delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ The EZAudioDevice being used to pull the microphone data.
+ - On iOS this can be any of the available microphones on the iPhone/iPad devices (usually there are 3). Defaults to the first microphone found (bottom mic)
+ - On OSX this can be any of the plugged in devices that Core Audio can detect (see kAudioUnitSubType_HALOutput for more information)
+ System Preferences -> Sound for the available inputs)
+ */
+@property (nonatomic, strong) EZAudioDevice *device;
+
+//------------------------------------------------------------------------------
+
+/**
+ A BOOL describing whether the microphone is on and passing back audio data to its delegate.
+ */
+@property (nonatomic, assign) BOOL microphoneOn;
+
+//------------------------------------------------------------------------------
+
+/**
+ An EZOutput to use for porting the microphone input out (passthrough).
+ */
+@property (nonatomic, strong) EZOutput *output;
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use initWithMicrophoneDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
+ @param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
+- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a custom AudioStreamBasicDescription and provides the caller to specify a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use initWithMicrophoneDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
+ @param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
+-(EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
+ @param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
+- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ startsImmediately:(BOOL)startsImmediately;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a custom AudioStreamBasicDescription and provides the caller with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
+ @param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
+ @param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
+- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+ startsImmediately:(BOOL)startsImmediately;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use microphoneWithDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
+ @param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @return An instance of the EZMicrophone class. This should be declared as a strong property!
+ */
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback. This will not start fetching the audio until startFetchingAudio has been called. Use microphoneWithDelegate:startsImmediately: to instantiate this class and immediately start fetching audio data.
+ @param delegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
+ @return An instance of the EZMicrophone class. This should be declared as a strong property!
+ */
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
+
+ @param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ startsImmediately:(BOOL)startsImmediately;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZMicrophone with a delegate to respond to the audioReceived callback and allows the caller to specify whether they'd immediately like to start fetching the audio data.
+
+ @param microphoneDelegate A EZMicrophoneDelegate delegate that will receive the audioReceived callback.
+ @param audioStreamBasicDescription A custom AudioStreamBasicFormat for the microphone input.
+ @param startsImmediately A boolean indicating whether to start fetching the data immediately. IF YES, the delegate's audioReceived callback will immediately start getting called.
+ @return An instance of the EZMicrophone class. This should be strongly retained.
+ */
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+ startsImmediately:(BOOL)startsImmediately;
+
+//------------------------------------------------------------------------------
+#pragma mark - Shared Instance
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Shared Instance
+///-----------------------------------------------------------
+
+/**
+ A shared instance of the microphone component. Most applications will only need to use one instance of the microphone component across multiple views. Make sure to call the `startFetchingAudio` method to receive the audio data in the microphone delegate.
+ @return A shared instance of the `EZAudioMicrophone` component.
+ */
++ (EZMicrophone *)sharedMicrophone;
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Starting/Stopping The Microphone
+///-----------------------------------------------------------
+
+/**
+ Starts fetching audio from the default microphone. Will notify delegate with audioReceived callback.
+ */
+- (void)startFetchingAudio;
+
+//------------------------------------------------------------------------------
+
+/**
+ Stops fetching audio. Will stop notifying the delegate's audioReceived callback.
+ */
+- (void)stopFetchingAudio;
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Getting The Microphone's Audio Format
+///-----------------------------------------------------------
+
+/**
+ Provides the AudioStreamBasicDescription structure containing the format of the microphone's audio.
+ @return An AudioStreamBasicDescription structure describing the format of the microphone's audio.
+ */
+- (AudioStreamBasicDescription)audioStreamBasicDescription;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the underlying Audio Unit that is being used to fetch the audio.
+ @return The AudioUnit used for the microphone
+ */
+- (AudioUnit *)audioUnit;
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Customizing The Microphone Stream Format
+///-----------------------------------------------------------
+
+/**
+ Sets the AudioStreamBasicDescription on the microphone input. Must be linear PCM and must be the same sample rate as the stream format coming in (check the current `audioStreamBasicDescription` before setting).
+ @warning Do not set this while fetching audio (startFetchingAudio)
+ @param asbd The new AudioStreamBasicDescription to use in place of the current audio format description.
+ */
+- (void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd;
+
+///-----------------------------------------------------------
+/// @name Setting The Microphone's Hardware Device
+///-----------------------------------------------------------
+
+/**
+ Sets the EZAudioDevice being used to pull the microphone data.
+ - On iOS this can be any of the available microphones on the iPhone/iPad devices (usually there are 3). Defaults to the first microphone found (bottom mic)
+ - On OSX this can be any of the plugged in devices that Core Audio can detect (see kAudioUnitSubType_HALOutput for more information)
+ System Preferences -> Sound for the available inputs)
+ @param device An EZAudioDevice instance that should be used to fetch the microphone data.
+ */
+- (void)setDevice:(EZAudioDevice *)device;
+
+//------------------------------------------------------------------------------
+#pragma mark - Direct Output
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Setting The Microphone's Output (Direct Out)
+///-----------------------------------------------------------
+
+/**
+ When set this will pipe out the contents of the microphone into an EZOutput. This is known as a passthrough or direct out that will simply pipe the microphone input to an output.
+ @param output An EZOutput instance that the microphone will use to output its audio data to the speaker.
+ */
+- (void)setOutput:(EZOutput *)output;
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass Methods
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Subclass
+///-----------------------------------------------------------
+
+/**
+ The default AudioStreamBasicDescription set as the stream format of the microphone if no custom description is set. Defaults to a non-interleaved float format with the number of channels specified by the `numberOfChannels` method.
+ @return An AudioStreamBasicDescription that will be used as the default stream format.
+ */
+- (AudioStreamBasicDescription)defaultStreamFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ The number of channels the input microphone is expected to have. Defaults to 1 (assumes microphone is mono).
+ @return A UInt32 representing the number of channels expected for the microphone.
+ */
+- (UInt32)numberOfChannels;
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+//
+// EZMicrophone.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 9/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZMicrophone.h"
+#import "EZAudioFloatConverter.h"
+#import "EZAudioUtilities.h"
+#import "EZAudioDevice.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct EZMicrophoneInfo
+{
+ AudioUnit audioUnit;
+ AudioBufferList *audioBufferList;
+ float **floatData;
+ AudioStreamBasicDescription inputFormat;
+ AudioStreamBasicDescription streamFormat;
+} EZMicrophoneInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - Callbacks
+//------------------------------------------------------------------------------
+
+static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData);
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophone (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZMicrophone ()
+@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
+@property (nonatomic, assign) EZMicrophoneInfo *info;
+@end
+
+@implementation EZMicrophone
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+ [EZAudioUtilities checkResult:AudioUnitUninitialize(self.info->audioUnit)
+ operation:"Failed to unintialize audio unit for microphone"];
+ [EZAudioUtilities freeBufferList:self.info->audioBufferList];
+ [EZAudioUtilities freeFloatBuffers:self.info->floatData
+ numberOfChannels:self.info->streamFormat.mChannelsPerFrame];
+ free(self.info);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (id)init
+{
+ self = [super init];
+ if(self)
+ {
+ self.info = (EZMicrophoneInfo *)malloc(sizeof(EZMicrophoneInfo));
+ memset(self.info, 0, sizeof(EZMicrophoneInfo));
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+{
+ self = [super init];
+ if(self)
+ {
+ self.info = (EZMicrophoneInfo *)malloc(sizeof(EZMicrophoneInfo));
+ memset(self.info, 0, sizeof(EZMicrophoneInfo));
+ _delegate = delegate;
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+-(EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ self = [self initWithMicrophoneDelegate:delegate];
+ if(self)
+ {
+ [self setAudioStreamBasicDescription:audioStreamBasicDescription];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ startsImmediately:(BOOL)startsImmediately
+{
+ self = [self initWithMicrophoneDelegate:delegate];
+ if(self)
+ {
+ startsImmediately ? [self startFetchingAudio] : -1;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+-(EZMicrophone *)initWithMicrophoneDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+ startsImmediately:(BOOL)startsImmediately
+{
+ self = [self initWithMicrophoneDelegate:delegate
+ withAudioStreamBasicDescription:audioStreamBasicDescription];
+ if(self)
+ {
+ startsImmediately ? [self startFetchingAudio] : -1;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+{
+ return [[EZMicrophone alloc] initWithMicrophoneDelegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ return [[EZMicrophone alloc] initWithMicrophoneDelegate:delegate
+ withAudioStreamBasicDescription:audioStreamBasicDescription];
+}
+
+//------------------------------------------------------------------------------
+
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ startsImmediately:(BOOL)startsImmediately
+{
+ return [[EZMicrophone alloc] initWithMicrophoneDelegate:delegate
+ startsImmediately:startsImmediately];
+}
+
+//------------------------------------------------------------------------------
+
++ (EZMicrophone *)microphoneWithDelegate:(id<EZMicrophoneDelegate>)delegate
+ withAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+ startsImmediately:(BOOL)startsImmediately
+{
+ return [[EZMicrophone alloc] initWithMicrophoneDelegate:delegate
+ withAudioStreamBasicDescription:audioStreamBasicDescription
+ startsImmediately:startsImmediately];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Singleton
+//------------------------------------------------------------------------------
+
++ (EZMicrophone *)sharedMicrophone
+{
+ static EZMicrophone *_sharedMicrophone = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ _sharedMicrophone = [[EZMicrophone alloc] init];
+ });
+ return _sharedMicrophone;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ // Create an input component description for mic input
+ AudioComponentDescription inputComponentDescription;
+ inputComponentDescription.componentType = kAudioUnitType_Output;
+ inputComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
+#if TARGET_OS_IPHONE
+ inputComponentDescription.componentSubType = kAudioUnitSubType_RemoteIO;
+#elif TARGET_OS_MAC
+ inputComponentDescription.componentSubType = kAudioUnitSubType_HALOutput;
+#endif
+ // The following must be set to zero unless a specific value is requested.
+ inputComponentDescription.componentFlags = 0;
+ inputComponentDescription.componentFlagsMask = 0;
+
+ // get the first matching component
+ AudioComponent inputComponent = AudioComponentFindNext( NULL , &inputComponentDescription);
+ NSAssert(inputComponent, @"Couldn't get input component unit!");
+
+ // create new instance of component
+ [EZAudioUtilities checkResult:AudioComponentInstanceNew(inputComponent, &self.info->audioUnit)
+ operation:"Failed to get audio component instance"];
+
+#if TARGET_OS_IPHONE
+ // must enable input scope for remote IO unit
+ UInt32 flag = 1;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Input,
+ 1,
+ &flag,
+ sizeof(flag))
+ operation:"Couldn't enable input on remote IO unit."];
+#endif
+ [self setDevice:[EZAudioDevice currentInputDevice]];
+
+ UInt32 propSize = sizeof(self.info->inputFormat);
+ [EZAudioUtilities checkResult:AudioUnitGetProperty(self.info->audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 1,
+ &self.info->inputFormat,
+ &propSize)
+ operation:"Failed to get stream format of microphone input scope"];
+#if TARGET_OS_IPHONE
+ self.info->inputFormat.mSampleRate = [[AVAudioSession sharedInstance] sampleRate];
+ NSAssert(self.info->inputFormat.mSampleRate, @"Expected AVAudioSession sample rate to be greater than 0.0. Did you setup the audio session?");
+#elif TARGET_OS_MAC
+#endif
+ [self setAudioStreamBasicDescription:[self defaultStreamFormat]];
+
+ // render callback
+ AURenderCallbackStruct renderCallbackStruct;
+ renderCallbackStruct.inputProc = EZAudioMicrophoneCallback;
+ renderCallbackStruct.inputProcRefCon = (__bridge void *)(self);
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioOutputUnitProperty_SetInputCallback,
+ kAudioUnitScope_Global,
+ 1,
+ &renderCallbackStruct,
+ sizeof(renderCallbackStruct))
+ operation:"Failed to set render callback"];
+
+ [EZAudioUtilities checkResult:AudioUnitInitialize(self.info->audioUnit)
+ operation:"Failed to initialize input unit"];
+
+ // setup notifications
+ [self setupNotifications];
+}
+
+- (void)setupNotifications
+{
+#if TARGET_OS_IPHONE
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(microphoneWasInterrupted:)
+ name:AVAudioSessionInterruptionNotification
+ object:nil];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(microphoneRouteChanged:)
+ name:AVAudioSessionRouteChangeNotification
+ object:nil];
+#elif TARGET_OS_MAC
+#endif
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+#if TARGET_OS_IPHONE
+
+- (void)microphoneWasInterrupted:(NSNotification *)notification
+{
+ AVAudioSessionInterruptionType type = [notification.userInfo[AVAudioSessionInterruptionTypeKey] unsignedIntegerValue];
+ switch (type)
+ {
+ case AVAudioSessionInterruptionTypeBegan:
+ {
+ [self stopFetchingAudio];
+ break;
+ }
+ case AVAudioSessionInterruptionTypeEnded:
+ {
+ AVAudioSessionInterruptionOptions option = [notification.userInfo[AVAudioSessionInterruptionOptionKey] unsignedIntegerValue];
+ if (option == AVAudioSessionInterruptionOptionShouldResume)
+ {
+ [self startFetchingAudio];
+ }
+ break;
+ }
+ default:
+ {
+ break;
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphoneRouteChanged:(NSNotification *)notification
+{
+ EZAudioDevice *device = [EZAudioDevice currentInputDevice];
+ [self setDevice:device];
+}
+
+#elif TARGET_OS_MAC
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+-(void)startFetchingAudio
+{
+ //
+ // Start output unit
+ //
+ [EZAudioUtilities checkResult:AudioOutputUnitStart(self.info->audioUnit)
+ operation:"Failed to start microphone audio unit"];
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(microphone:changedPlayingState:)])
+ {
+ [self.delegate microphone:self changedPlayingState:YES];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+-(void)stopFetchingAudio
+{
+ //
+ // Stop output unit
+ //
+ [EZAudioUtilities checkResult:AudioOutputUnitStop(self.info->audioUnit)
+ operation:"Failed to stop microphone audio unit"];
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(microphone:changedPlayingState:)])
+ {
+ [self.delegate microphone:self changedPlayingState:NO];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+-(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ return self.info->streamFormat;
+}
+
+//------------------------------------------------------------------------------
+
+-(AudioUnit *)audioUnit
+{
+ return &self.info->audioUnit;
+}
+
+//------------------------------------------------------------------------------
+
+- (UInt32)maximumBufferSize
+{
+ UInt32 maximumBufferSize;
+ UInt32 propSize = sizeof(maximumBufferSize);
+ [EZAudioUtilities checkResult:AudioUnitGetProperty(self.info->audioUnit,
+ kAudioUnitProperty_MaximumFramesPerSlice,
+ kAudioUnitScope_Global,
+ 0,
+ &maximumBufferSize,
+ &propSize)
+ operation:"Failed to get maximum number of frames per slice"];
+ return maximumBufferSize;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setMicrophoneOn:(BOOL)microphoneOn
+{
+ _microphoneOn = microphoneOn;
+ if (microphoneOn)
+ {
+ [self startFetchingAudio];
+ }
+ else {
+ [self stopFetchingAudio];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setAudioStreamBasicDescription:(AudioStreamBasicDescription)asbd
+{
+ if (self.floatConverter)
+ {
+ [EZAudioUtilities freeBufferList:self.info->audioBufferList];
+ [EZAudioUtilities freeFloatBuffers:self.info->floatData
+ numberOfChannels:self.info->streamFormat.mChannelsPerFrame];
+ }
+
+ //
+ // Set new stream format
+ //
+ self.info->streamFormat = asbd;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 0,
+ &asbd,
+ sizeof(asbd))
+ operation:"Failed to set stream format on input scope"];
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 1,
+ &asbd,
+ sizeof(asbd))
+ operation:"Failed to set stream format on output scope"];
+
+ //
+ // Allocate scratch buffers
+ //
+ UInt32 maximumBufferSize = [self maximumBufferSize];
+ BOOL isInterleaved = [EZAudioUtilities isInterleaved:asbd];
+ UInt32 channels = asbd.mChannelsPerFrame;
+ self.floatConverter = [[EZAudioFloatConverter alloc] initWithInputFormat:asbd];
+ self.info->floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:maximumBufferSize
+ numberOfChannels:channels];
+ self.info->audioBufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:maximumBufferSize
+ numberOfChannels:channels
+ interleaved:isInterleaved];
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(microphone:hasAudioStreamBasicDescription:)])
+ {
+ [self.delegate microphone:self hasAudioStreamBasicDescription:asbd];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setDevice:(EZAudioDevice *)device
+{
+#if TARGET_OS_IPHONE
+
+ // if the devices are equal then ignore
+ if ([device isEqual:self.device])
+ {
+ return;
+ }
+
+ NSError *error;
+ [[AVAudioSession sharedInstance] setPreferredInput:device.port error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting input device port (%@), reason: %@",
+ device.port,
+ error.localizedDescription);
+ }
+ else
+ {
+ if (device.dataSource)
+ {
+ [[AVAudioSession sharedInstance] setInputDataSource:device.dataSource error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting input data source (%@), reason: %@",
+ device.dataSource,
+ error.localizedDescription);
+ }
+ }
+ }
+
+#elif TARGET_OS_MAC
+ UInt32 inputEnabled = device.inputChannelCount > 0;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Input,
+ 1,
+ &inputEnabled,
+ sizeof(inputEnabled))
+ operation:"Failed to set flag on device input"];
+
+ UInt32 outputEnabled = device.outputChannelCount > 0;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Output,
+ 0,
+ &outputEnabled,
+ sizeof(outputEnabled))
+ operation:"Failed to set flag on device output"];
+
+ AudioDeviceID deviceId = device.deviceID;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global,
+ 0,
+ &deviceId,
+ sizeof(AudioDeviceID))
+ operation:"Couldn't set default device on I/O unit"];
+#endif
+
+ //
+ // Store device
+ //
+ _device = device;
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(microphone:changedDevice:)])
+ {
+ [self.delegate microphone:self changedDevice:device];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Output
+//------------------------------------------------------------------------------
+
+- (void)setOutput:(EZOutput *)output
+{
+ _output = output;
+ _output.inputFormat = self.audioStreamBasicDescription;
+ _output.dataSource = self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutputDataSource
+//------------------------------------------------------------------------------
+
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp
+{
+ memcpy(audioBufferList,
+ self.info->audioBufferList,
+ sizeof(AudioBufferList) + (self.info->audioBufferList->mNumberBuffers - 1)*sizeof(AudioBuffer));
+ return noErr;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)defaultStreamFormat
+{
+ return [EZAudioUtilities floatFormatWithNumberOfChannels:[self numberOfChannels]
+ sampleRate:self.info->inputFormat.mSampleRate];
+}
+
+//------------------------------------------------------------------------------
+
+- (UInt32)numberOfChannels
+{
+#if TARGET_OS_IPHONE
+ return 1;
+#elif TARGET_OS_MAC
+ return (UInt32)self.device.inputChannelCount;
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - Callbacks
+//------------------------------------------------------------------------------
+
+static OSStatus EZAudioMicrophoneCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ EZMicrophone *microphone = (__bridge EZMicrophone *)inRefCon;
+ EZMicrophoneInfo *info = (EZMicrophoneInfo *)microphone.info;
+
+ //
+ // Make sure the size of each buffer in the stored buffer array
+ // is properly set using the actual number of frames coming in!
+ //
+ for (int i = 0; i < info->audioBufferList->mNumberBuffers; i++) {
+ info->audioBufferList->mBuffers[i].mDataByteSize = inNumberFrames * info->streamFormat.mBytesPerFrame;
+ }
+
+ //
+ // Render audio into buffer
+ //
+ OSStatus result = AudioUnitRender(info->audioUnit,
+ ioActionFlags,
+ inTimeStamp,
+ inBusNumber,
+ inNumberFrames,
+ info->audioBufferList);
+
+ //
+ // Notify delegate of new buffer list to process
+ //
+ if ([microphone.delegate respondsToSelector:@selector(microphone:hasBufferList:withBufferSize:withNumberOfChannels:)])
+ {
+ [microphone.delegate microphone:microphone
+ hasBufferList:info->audioBufferList
+ withBufferSize:inNumberFrames
+ withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
+ }
+
+ //
+ // Notify delegate of new float data processed
+ //
+ if ([microphone.delegate respondsToSelector:@selector(microphone:hasAudioReceived:withBufferSize:withNumberOfChannels:)])
+ {
+ //
+ // Convert to float
+ //
+ [microphone.floatConverter convertDataFromAudioBufferList:info->audioBufferList
+ withNumberOfFrames:inNumberFrames
+ toFloatBuffers:info->floatData];
+ [microphone.delegate microphone:microphone
+ hasAudioReceived:info->floatData
+ withBufferSize:inNumberFrames
+ withNumberOfChannels:info->streamFormat.mChannelsPerFrame];
+ }
+
+ return result;
+}
\ No newline at end of file
--- /dev/null
+//
+// EZOutput.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+#if TARGET_OS_IPHONE
+#elif TARGET_OS_MAC
+#import <AudioUnit/AudioUnit.h>
+#endif
+
+@class EZAudioDevice;
+@class EZOutput;
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+FOUNDATION_EXPORT UInt32 const EZOutputMaximumFramesPerSlice;
+FOUNDATION_EXPORT Float64 const EZOutputDefaultSampleRate;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutputDataSource
+//------------------------------------------------------------------------------
+
+/**
+ The EZOutputDataSource specifies a receiver to provide audio data when the EZOutput is started. Since the 0.4.0 release this has been simplified to only one data source method.
+ */
+@protocol EZOutputDataSource <NSObject>
+
+@optional
+///-----------------------------------------------------------
+/// @name Providing Audio Data
+///-----------------------------------------------------------
+
+@required
+
+/**
+ Provides a way to provide output with data anytime the EZOutput needs audio data to play. This function provides an already allocated AudioBufferList to use for providing audio data into the output buffer. The expected format of the audio data provided here is specified by the EZOutput `inputFormat` property. This audio data will be converted into the client format specified by the EZOutput `clientFormat` property.
+ @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.
+ @param timestamp A AudioTimeStamp pointer to use if you need the current host time.
+ @return An OSStatus code. If there was no error then use the noErr status code.
+ */
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutputDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZOutputDelegate for the EZOutput component provides a receiver to handle play state, device, and audio data change events. This is very similar to the EZMicrophoneDelegate for the EZMicrophone and the EZAudioFileDelegate for the EZAudioFile.
+ */
+@protocol EZOutputDelegate <NSObject>
+
+@optional
+
+/**
+ Called anytime the EZOutput starts or stops.
+ @param output The instance of the EZOutput that triggered the event.
+ @param isPlaying A BOOL indicating whether the EZOutput instance is playing or not.
+ */
+- (void)output:(EZOutput *)output changedPlayingState:(BOOL)isPlaying;
+
+//------------------------------------------------------------------------------
+
+/**
+ Called anytime the `device` changes on an EZOutput instance.
+ @param output The instance of the EZOutput that triggered the event.
+ @param device The instance of the new EZAudioDevice the output is using to play audio data.
+ */
+- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device;
+
+//------------------------------------------------------------------------------
+
+/**
+ Like the EZMicrophoneDelegate, for the EZOutput this method provides an array of float arrays of the audio received, each float array representing a channel of audio data. This occurs on the background thread so any drawing code must explicity perform its functions on the main thread.
+ @param output The instance of the EZOutput that triggered the event.
+ @param buffer The audio data as an array of float arrays. In a stereo signal buffer[0] represents the left channel while buffer[1] would represent the right channel.
+ @param bufferSize A UInt32 representing the size of each of the buffers (the length of each float array).
+ @param numberOfChannels A UInt32 representing the number of channels (you can use this to know how many float arrays are in the `buffer` parameter.
+ @warning This function executes on a background thread to avoid blocking any audio operations. If operations should be performed on any other thread (like the main thread) it should be performed within a dispatch block like so: dispatch_async(dispatch_get_main_queue(), ^{ ...Your Code... })
+ */
+- (void) output:(EZOutput *)output
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels;
+
+//------------------------------------------------------------------------------
+
+@end
+
+/**
+ The EZOutput component provides a generic output to glue all the other EZAudio components together and push whatever sound you've created to the default output device (think opposite of the microphone). The EZOutputDataSource provides the required AudioBufferList needed to populate the output buffer while the EZOutputDelegate provides the same kind of mechanism as the EZMicrophoneDelegate or EZAudioFileDelegate in that you will receive a callback that provides non-interleaved, float data for visualizing the output (done using an internal float converter). As of 0.4.0 the EZOutput has been simplified to a single EZOutputDataSource method and now uses an AUGraph to provide format conversion from the `inputFormat` to the playback graph's `clientFormat` linear PCM formats, mixer controls for setting volume and pan settings, hooks to add in any number of effect audio units (see the `connectOutputOfSourceNode:sourceNodeOutputBus:toDestinationNode:destinationNodeInputBus:inGraph:` subclass method), and hardware device toggling (via EZAudioDevice).
+ */
+@interface EZOutput : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
+ @param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
+ @return A newly created instance of the EZOutput class.
+ */
+- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource;
+
+/**
+ Creates a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
+ @param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
+ @param inputFormat The AudioStreamBasicDescription of the EZOutput.
+ @warning AudioStreamBasicDescription input formats must be linear PCM!
+ @return A newly created instance of the EZOutput class.
+ */
+- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
+ inputFormat:(AudioStreamBasicDescription)inputFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Class method to create a new instance of the EZOutput
+ @return A newly created instance of the EZOutput class.
+ */
++ (instancetype)output;
+
+/**
+ Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
+ @param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
+ @return A newly created instance of the EZOutput class.
+ */
++ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource;
+
+/**
+ Class method to create a new instance of the EZOutput and allows the caller to specify an EZOutputDataSource.
+ @param dataSource The EZOutputDataSource that will be used to pull the audio data for the output callback.
+ @param audioStreamBasicDescription The AudioStreamBasicDescription of the EZOutput.
+ @warning AudioStreamBasicDescriptions that are invalid will cause the EZOutput to fail to initialize
+ @return A newly created instance of the EZOutput class.
+ */
++ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
+ inputFormat:(AudioStreamBasicDescription)inputFormat;
+
+//------------------------------------------------------------------------------
+#pragma mark - Singleton
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Shared Instance
+///-----------------------------------------------------------
+
+/**
+ Creates a shared instance of the EZOutput (one app will usually only need one output and share the role of the EZOutputDataSource).
+ @return The shared instance of the EZOutput class.
+ */
++ (instancetype)sharedOutput;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Setting/Getting The Stream Formats
+///-----------------------------------------------------------
+
+/**
+ Provides the AudioStreamBasicDescription structure used at the beginning of the playback graph which is then converted into the `clientFormat` using the AUConverter audio unit.
+ @warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported...the EZAudioFile's clientFormat performs the audio conversion on the fly from compressed to linear PCM so there is no additional work to be done there.
+ @return An AudioStreamBasicDescription structure describing
+ */
+@property (nonatomic, readwrite) AudioStreamBasicDescription inputFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the AudioStreamBasicDescription structure that serves as the common format used throughout the playback graph (similar to how the EZAudioFile as a clientFormat that is linear PCM to be shared amongst other components). The `inputFormat` is converted into this format at the beginning of the playback graph using an AUConverter audio unit. Defaults to the whatever the `defaultClientFormat` method returns is if a custom one isn't explicitly set.
+ @warning The AudioStreamBasicDescription set here must be linear PCM. Compressed formats are not supported by Audio Units.
+ @return An AudioStreamBasicDescription structure describing the common client format for the playback graph.
+ */
+@property (nonatomic, readwrite) AudioStreamBasicDescription clientFormat;
+
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Setting/Getting The Data Source and Delegate
+///-----------------------------------------------------------
+
+/**
+ The EZOutputDataSource that provides the audio data in the `inputFormat` for the EZOutput to play. If an EZOutputDataSource is not specified then the EZOutput will just output silence.
+ */
+@property (nonatomic, weak) id<EZOutputDataSource> dataSource;
+
+//------------------------------------------------------------------------------
+
+/**
+ The EZOutputDelegate for which to handle the output callbacks
+ */
+@property (nonatomic, weak) id<EZOutputDelegate> delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides a flag indicating whether the EZOutput is pulling audio data from the EZOutputDataSource for playback.
+ @return YES if the EZOutput is running, NO if it is stopped
+ */
+@property (readonly) BOOL isPlaying;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current pan from the audio player's mixer audio unit in the playback graph. Setting the pan adjusts the direction of the audio signal from left (0) to right (1). Default is 0.5 (middle).
+ */
+@property (nonatomic, assign) float pan;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current volume from the audio player's mixer audio unit in the playback graph. Setting the volume adjusts the gain of the output between 0 and 1. Default is 1.
+ */
+@property (nonatomic, assign) float volume;
+
+//------------------------------------------------------------------------------
+#pragma mark - Core Audio Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Core Audio Properties
+///-----------------------------------------------------------
+
+/**
+ The AUGraph used to chain together the converter, mixer, and output audio units.
+ */
+@property (readonly) AUGraph graph;
+
+//------------------------------------------------------------------------------
+
+/**
+ The AudioUnit that is being used to convert the audio data coming into the output's playback graph.
+ */
+@property (readonly) AudioUnit converterAudioUnit;
+
+//------------------------------------------------------------------------------
+
+/**
+ The AudioUnit that is being used as the mixer to adjust the volume on the output's playback graph.
+ */
+@property (readonly) AudioUnit mixerAudioUnit;
+
+//------------------------------------------------------------------------------
+
+/**
+ The AudioUnit that is being used as the hardware output for the output's playback graph.
+ */
+@property (readonly) AudioUnit outputAudioUnit;
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Getting/Setting The Output's Hardware Device
+///-----------------------------------------------------------
+
+/**
+ An EZAudioDevice instance that is used to route the audio data out to the speaker. To find a list of available output devices see the EZAudioDevice `outputDevices` method.
+ */
+@property (nonatomic, strong, readwrite) EZAudioDevice *device;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Starting/Stopping The Output
+///-----------------------------------------------------------
+
+/**
+ Starts pulling audio data from the EZOutputDataSource to the default device output.
+ */
+- (void)startPlayback;
+
+///-----------------------------------------------------------
+
+/**
+ Stops pulling audio data from the EZOutputDataSource to the default device output.
+ */
+- (void)stopPlayback;
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Subclass
+///-----------------------------------------------------------
+
+/**
+ This method handles connecting the converter node to the mixer node within the AUGraph that is being used as the playback graph. Subclasses can override this method and insert their custom nodes to perform effects processing on the audio data being rendered.
+
+ This was inspired by Daniel Kennett's blog post on how to add a custom equalizer to a CocoaLibSpotify SPCoreAudioController's AUGraph. For more information see Daniel's post and example code here: http://ikennd.ac/blog/2012/04/augraph-basics-in-cocoalibspotify/.
+ @param sourceNode An AUNode representing the node the audio data is coming from.
+ @param sourceNodeOutputBus A UInt32 representing the output bus from the source node that should be connected into the next node's input bus.
+ @param destinationNode An AUNode representing the node the audio data should be connected to.
+ @param destinationNodeInputBus A UInt32 representing the input bus the source node's output bus should be connecting to.
+ @param graph The AUGraph that is being used to hold the playback graph. Same as from the `graph` property.
+ @return An OSStatus code. For no error return back `noErr`.
+ */
+- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
+ sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
+ toDestinationNode:(AUNode)destinationNode
+ destinationNodeInputBus:(UInt32)destinationNodeInputBus
+ inGraph:(AUGraph)graph;
+
+//------------------------------------------------------------------------------
+
+/**
+ The default AudioStreamBasicDescription set as the client format of the output if no custom `clientFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
+ @return An AudioStreamBasicDescription that will be used as the default stream format.
+ */
+- (AudioStreamBasicDescription)defaultClientFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ The default AudioStreamBasicDescription set as the `inputFormat` of the output if no custom `inputFormat` is set. Defaults to a 44.1 kHz stereo, non-interleaved, float format.
+ @return An AudioStreamBasicDescription that will be used as the default stream format.
+ */
+- (AudioStreamBasicDescription)defaultInputFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ The default value used as the AudioUnit subtype when creating the hardware output component. By default this is kAudioUnitSubType_RemoteIO for iOS and kAudioUnitSubType_HALOutput for OSX.
+ @warning If you change this to anything other than kAudioUnitSubType_HALOutput for OSX you will get a failed assertion because devices can only be set when using the HAL audio unit.
+ @return An OSType that represents the AudioUnit subtype for the hardware output component.
+ */
+- (OSType)outputAudioUnitSubType;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZOutput.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/2/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZOutput.h"
+#import "EZAudioDevice.h"
+#import "EZAudioFloatConverter.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+UInt32 const EZOutputMaximumFramesPerSlice = 4096;
+Float64 const EZOutputDefaultSampleRate = 44100.0f;
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ // stream format params
+ AudioStreamBasicDescription inputFormat;
+ AudioStreamBasicDescription clientFormat;
+
+ // float converted data
+ float **floatData;
+
+ // nodes
+ EZAudioNodeInfo converterNodeInfo;
+ EZAudioNodeInfo mixerNodeInfo;
+ EZAudioNodeInfo outputNodeInfo;
+
+ // audio graph
+ AUGraph graph;
+} EZOutputInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - Callbacks (Declaration)
+//------------------------------------------------------------------------------
+
+OSStatus EZOutputConverterInputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData);
+
+//------------------------------------------------------------------------------
+
+OSStatus EZOutputGraphRenderCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData);
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutput (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZOutput ()
+@property (nonatomic, strong) EZAudioFloatConverter *floatConverter;
+@property (nonatomic, assign) EZOutputInfo *info;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZOutput (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZOutput
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ if (self.floatConverter)
+ {
+ self.floatConverter = nil;
+ [EZAudioUtilities freeFloatBuffers:self.info->floatData
+ numberOfChannels:self.info->clientFormat.mChannelsPerFrame];
+ }
+ [EZAudioUtilities checkResult:AUGraphStop(self.info->graph)
+ operation:"Failed to stop graph"];
+ [EZAudioUtilities checkResult:AUGraphClose(self.info->graph)
+ operation:"Failed to close graph"];
+ [EZAudioUtilities checkResult:DisposeAUGraph(self.info->graph)
+ operation:"Failed to dispose of graph"];
+ free(self.info);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initialization
+//------------------------------------------------------------------------------
+
+- (instancetype) init
+{
+ self = [super init];
+ if (self)
+ {
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
+{
+ self = [self init];
+ if (self)
+ {
+ self.dataSource = dataSource;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithDataSource:(id<EZOutputDataSource>)dataSource
+ inputFormat:(AudioStreamBasicDescription)inputFormat
+{
+ self = [self initWithDataSource:dataSource];
+ if (self)
+ {
+ self.inputFormat = inputFormat;
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (instancetype)output
+{
+ return [[self alloc] init];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
+{
+ return [[self alloc] initWithDataSource:dataSource];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)outputWithDataSource:(id<EZOutputDataSource>)dataSource
+ inputFormat:(AudioStreamBasicDescription)inputFormat
+{
+ return [[self alloc] initWithDataSource:dataSource
+ inputFormat:inputFormat];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Singleton
+//------------------------------------------------------------------------------
+
++ (instancetype)sharedOutput
+{
+ static EZOutput *output;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^
+ {
+ output = [[self alloc] init];
+ });
+ return output;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ //
+ // Create structure to hold state data
+ //
+ self.info = (EZOutputInfo *)malloc(sizeof(EZOutputInfo));
+ memset(self.info, 0, sizeof(EZOutputInfo));
+
+ //
+ // Setup the audio graph
+ //
+ [EZAudioUtilities checkResult:NewAUGraph(&self.info->graph)
+ operation:"Failed to create graph"];
+
+ //
+ // Add converter node
+ //
+ AudioComponentDescription converterDescription;
+ converterDescription.componentType = kAudioUnitType_FormatConverter;
+ converterDescription.componentSubType = kAudioUnitSubType_AUConverter;
+ converterDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
+ [EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
+ &converterDescription,
+ &self.info->converterNodeInfo.node)
+ operation:"Failed to add converter node to audio graph"];
+
+ //
+ // Add mixer node
+ //
+ AudioComponentDescription mixerDescription;
+ mixerDescription.componentType = kAudioUnitType_Mixer;
+#if TARGET_OS_IPHONE
+ mixerDescription.componentSubType = kAudioUnitSubType_MultiChannelMixer;
+#elif TARGET_OS_MAC
+ mixerDescription.componentSubType = kAudioUnitSubType_StereoMixer;
+#endif
+ mixerDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
+ [EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
+ &mixerDescription,
+ &self.info->mixerNodeInfo.node)
+ operation:"Failed to add mixer node to audio graph"];
+
+ //
+ // Add output node
+ //
+ AudioComponentDescription outputDescription;
+ outputDescription.componentType = kAudioUnitType_Output;
+ outputDescription.componentSubType = [self outputAudioUnitSubType];
+ outputDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
+ [EZAudioUtilities checkResult:AUGraphAddNode(self.info->graph,
+ &outputDescription,
+ &self.info->outputNodeInfo.node)
+ operation:"Failed to add output node to audio graph"];
+
+ //
+ // Open the graph
+ //
+ [EZAudioUtilities checkResult:AUGraphOpen(self.info->graph)
+ operation:"Failed to open graph"];
+
+ //
+ // Make node connections
+ //
+ OSStatus status = [self connectOutputOfSourceNode:self.info->converterNodeInfo.node
+ sourceNodeOutputBus:0
+ toDestinationNode:self.info->mixerNodeInfo.node
+ destinationNodeInputBus:0
+ inGraph:self.info->graph];
+ [EZAudioUtilities checkResult:status
+ operation:"Failed to connect output of source node to destination node in graph"];
+
+ //
+ // Connect mixer to output
+ //
+ [EZAudioUtilities checkResult:AUGraphConnectNodeInput(self.info->graph,
+ self.info->mixerNodeInfo.node,
+ 0,
+ self.info->outputNodeInfo.node,
+ 0)
+ operation:"Failed to connect mixer node to output node"];
+
+ //
+ // Get the audio units
+ //
+ [EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
+ self.info->converterNodeInfo.node,
+ &converterDescription,
+ &self.info->converterNodeInfo.audioUnit)
+ operation:"Failed to get converter audio unit"];
+ [EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
+ self.info->mixerNodeInfo.node,
+ &mixerDescription,
+ &self.info->mixerNodeInfo.audioUnit)
+ operation:"Failed to get mixer audio unit"];
+ [EZAudioUtilities checkResult:AUGraphNodeInfo(self.info->graph,
+ self.info->outputNodeInfo.node,
+ &outputDescription,
+ &self.info->outputNodeInfo.audioUnit)
+ operation:"Failed to get output audio unit"];
+
+ //
+ // Add a node input callback for the converter node
+ //
+ AURenderCallbackStruct converterCallback;
+ converterCallback.inputProc = EZOutputConverterInputCallback;
+ converterCallback.inputProcRefCon = (__bridge void *)(self);
+ [EZAudioUtilities checkResult:AUGraphSetNodeInputCallback(self.info->graph,
+ self.info->converterNodeInfo.node,
+ 0,
+ &converterCallback)
+ operation:"Failed to set render callback on converter node"];
+
+ //
+ // Set stream formats
+ //
+ [self setClientFormat:[self defaultClientFormat]];
+ [self setInputFormat:[self defaultInputFormat]];
+
+ //
+ // Use the default device
+ //
+ EZAudioDevice *currentOutputDevice = [EZAudioDevice currentOutputDevice];
+ [self setDevice:currentOutputDevice];
+
+ //
+ // Set maximum frames per slice to 4096 to allow playback during
+ // lock screen (iOS only?)
+ //
+ UInt32 maximumFramesPerSlice = EZOutputMaximumFramesPerSlice;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
+ kAudioUnitProperty_MaximumFramesPerSlice,
+ kAudioUnitScope_Global,
+ 0,
+ &maximumFramesPerSlice,
+ sizeof(maximumFramesPerSlice))
+ operation:"Failed to set maximum frames per slice on mixer node"];
+
+ //
+ // Initialize all the audio units in the graph
+ //
+ [EZAudioUtilities checkResult:AUGraphInitialize(self.info->graph)
+ operation:"Failed to initialize graph"];
+
+ //
+ // Add render callback
+ //
+ [EZAudioUtilities checkResult:AudioUnitAddRenderNotify(self.info->mixerNodeInfo.audioUnit,
+ EZOutputGraphRenderCallback,
+ (__bridge void *)(self))
+ operation:"Failed to add render callback"];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)startPlayback
+{
+ //
+ // Start the AUGraph
+ //
+ [EZAudioUtilities checkResult:AUGraphStart(self.info->graph)
+ operation:"Failed to start graph"];
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(output:changedPlayingState:)])
+ {
+ [self.delegate output:self changedPlayingState:[self isPlaying]];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)stopPlayback
+{
+ //
+ // Stop the AUGraph
+ //
+ [EZAudioUtilities checkResult:AUGraphStop(self.info->graph)
+ operation:"Failed to stop graph"];
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(output:changedPlayingState:)])
+ {
+ [self.delegate output:self changedPlayingState:[self isPlaying]];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)clientFormat
+{
+ return self.info->clientFormat;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)inputFormat
+{
+ return self.info->inputFormat;
+}
+
+//------------------------------------------------------------------------------
+
+- (BOOL)isPlaying
+{
+ Boolean isPlaying;
+ [EZAudioUtilities checkResult:AUGraphIsRunning(self.info->graph,
+ &isPlaying)
+ operation:"Failed to check if graph is running"];
+ return isPlaying;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)pan
+{
+ AudioUnitParameterID param;
+#if TARGET_OS_IPHONE
+ param = kMultiChannelMixerParam_Pan;
+#elif TARGET_OS_MAC
+ param = kStereoMixerParam_Pan;
+#endif
+ AudioUnitParameterValue pan;
+ [EZAudioUtilities checkResult:AudioUnitGetParameter(self.info->mixerNodeInfo.audioUnit,
+ param,
+ kAudioUnitScope_Input,
+ 0,
+ &pan) operation:"Failed to get pan from mixer unit"];
+ return pan;
+}
+
+//------------------------------------------------------------------------------
+
+- (float)volume
+{
+ AudioUnitParameterID param;
+#if TARGET_OS_IPHONE
+ param = kMultiChannelMixerParam_Volume;
+#elif TARGET_OS_MAC
+ param = kStereoMixerParam_Volume;
+#endif
+ AudioUnitParameterValue volume;
+ [EZAudioUtilities checkResult:AudioUnitGetParameter(self.info->mixerNodeInfo.audioUnit,
+ param,
+ kAudioUnitScope_Input,
+ 0,
+ &volume)
+ operation:"Failed to get volume from mixer unit"];
+ return volume;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
+{
+ if (self.floatConverter)
+ {
+ self.floatConverter = nil;
+ [EZAudioUtilities freeFloatBuffers:self.info->floatData
+ numberOfChannels:self.clientFormat.mChannelsPerFrame];
+ }
+
+ self.info->clientFormat = clientFormat;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->converterNodeInfo.audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 0,
+ &self.info->clientFormat,
+ sizeof(self.info->clientFormat))
+ operation:"Failed to set output client format on converter audio unit"];
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 0,
+ &self.info->clientFormat,
+ sizeof(self.info->clientFormat))
+ operation:"Failed to set input client format on mixer audio unit"];
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->mixerNodeInfo.audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Output,
+ 0,
+ &self.info->clientFormat,
+ sizeof(self.info->clientFormat))
+ operation:"Failed to set output client format on mixer audio unit"];
+
+ self.floatConverter = [[EZAudioFloatConverter alloc] initWithInputFormat:clientFormat];
+ self.info->floatData = [EZAudioUtilities floatBuffersWithNumberOfFrames:EZOutputMaximumFramesPerSlice
+ numberOfChannels:clientFormat.mChannelsPerFrame];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setDevice:(EZAudioDevice *)device
+{
+#if TARGET_OS_IPHONE
+
+ // if the devices are equal then ignore
+ if ([device isEqual:self.device])
+ {
+ return;
+ }
+
+ NSError *error;
+ [[AVAudioSession sharedInstance] setOutputDataSource:device.dataSource error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting output device data source (%@), reason: %@",
+ device.dataSource,
+ error.localizedDescription);
+ }
+
+#elif TARGET_OS_MAC
+ UInt32 outputEnabled = device.outputChannelCount > 0;
+ NSAssert(outputEnabled, @"Selected EZAudioDevice does not have any output channels");
+ NSAssert([self outputAudioUnitSubType] == kAudioUnitSubType_HALOutput,
+ @"Audio device selection on OSX is only available when using the kAudioUnitSubType_HALOutput output unit subtype");
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->outputNodeInfo.audioUnit,
+ kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Output,
+ 0,
+ &outputEnabled,
+ sizeof(outputEnabled))
+ operation:"Failed to set flag on device output"];
+
+ AudioDeviceID deviceId = device.deviceID;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->outputNodeInfo.audioUnit,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global,
+ 0,
+ &deviceId,
+ sizeof(AudioDeviceID))
+ operation:"Couldn't set default device on I/O unit"];
+#endif
+
+ // store device
+ _device = device;
+
+ // notify delegate
+ if ([self.delegate respondsToSelector:@selector(output:changedDevice:)])
+ {
+ [self.delegate output:self changedDevice:device];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setInputFormat:(AudioStreamBasicDescription)inputFormat
+{
+ self.info->inputFormat = inputFormat;
+ [EZAudioUtilities checkResult:AudioUnitSetProperty(self.info->converterNodeInfo.audioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ 0,
+ &inputFormat,
+ sizeof(inputFormat))
+ operation:"Failed to set input format on converter audio unit"];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setPan:(float)pan
+{
+ AudioUnitParameterID param;
+#if TARGET_OS_IPHONE
+ param = kMultiChannelMixerParam_Pan;
+#elif TARGET_OS_MAC
+ param = kStereoMixerParam_Pan;
+#endif
+ [EZAudioUtilities checkResult:AudioUnitSetParameter(self.info->mixerNodeInfo.audioUnit,
+ param,
+ kAudioUnitScope_Input,
+ 0,
+ pan,
+ 0)
+ operation:"Failed to set volume on mixer unit"];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setVolume:(float)volume
+{
+ AudioUnitParameterID param;
+#if TARGET_OS_IPHONE
+ param = kMultiChannelMixerParam_Volume;
+#elif TARGET_OS_MAC
+ param = kStereoMixerParam_Volume;
+#endif
+ [EZAudioUtilities checkResult:AudioUnitSetParameter(self.info->mixerNodeInfo.audioUnit,
+ param,
+ kAudioUnitScope_Input,
+ 0,
+ volume,
+ 0)
+ operation:"Failed to set volume on mixer unit"];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Core Audio Properties
+//------------------------------------------------------------------------------
+
+- (AUGraph)graph
+{
+ return self.info->graph;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioUnit)converterAudioUnit
+{
+ return self.info->converterNodeInfo.audioUnit;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioUnit)mixerAudioUnit
+{
+ return self.info->mixerNodeInfo.audioUnit;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioUnit)outputAudioUnit
+{
+ return self.info->outputNodeInfo.audioUnit;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Subclass
+//------------------------------------------------------------------------------
+
+- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
+ sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
+ toDestinationNode:(AUNode)destinationNode
+ destinationNodeInputBus:(UInt32)destinationNodeInputBus
+ inGraph:(AUGraph)graph
+{
+ //
+ // Default implementation is to just connect the source to destination
+ //
+ [EZAudioUtilities checkResult:AUGraphConnectNodeInput(graph,
+ sourceNode,
+ sourceNodeOutputBus,
+ destinationNode,
+ destinationNodeInputBus)
+ operation:"Failed to connect converter node to mixer node"];
+ return noErr;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)defaultClientFormat
+{
+ return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:EZOutputDefaultSampleRate];
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)defaultInputFormat
+{
+ return [EZAudioUtilities stereoFloatNonInterleavedFormatWithSampleRate:EZOutputDefaultSampleRate];
+}
+
+//------------------------------------------------------------------------------
+
+- (OSType)outputAudioUnitSubType
+{
+#if TARGET_OS_IPHONE
+ return kAudioUnitSubType_RemoteIO;
+#elif TARGET_OS_MAC
+ return kAudioUnitSubType_HALOutput;
+#endif
+}
+
+//------------------------------------------------------------------------------
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - Callbacks (Implementation)
+//------------------------------------------------------------------------------
+
+OSStatus EZOutputConverterInputCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ EZOutput *output = (__bridge EZOutput *)inRefCon;
+
+ //
+ // Try to ask the data source for audio data to fill out the output's
+ // buffer list
+ //
+ if ([output.dataSource respondsToSelector:@selector(output:shouldFillAudioBufferList:withNumberOfFrames:timestamp:)])
+ {
+ return [output.dataSource output:output
+ shouldFillAudioBufferList:ioData
+ withNumberOfFrames:inNumberFrames
+ timestamp:inTimeStamp];
+ }
+ else
+ {
+ //
+ // Silence if there is nothing to output
+ //
+ for (int i = 0; i < ioData->mNumberBuffers; i++)
+ {
+ memset(ioData->mBuffers[i].mData,
+ 0,
+ ioData->mBuffers[i].mDataByteSize);
+ }
+ }
+ return noErr;
+}
+
+//------------------------------------------------------------------------------
+
+OSStatus EZOutputGraphRenderCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ EZOutput *output = (__bridge EZOutput *)inRefCon;
+
+ //
+ // provide the audio received delegate callback
+ //
+ if (*ioActionFlags & kAudioUnitRenderAction_PostRender)
+ {
+ if ([output.delegate respondsToSelector:@selector(output:playedAudio:withBufferSize:withNumberOfChannels:)])
+ {
+ UInt32 frames = ioData->mBuffers[0].mDataByteSize / output.info->clientFormat.mBytesPerFrame;
+ [output.floatConverter convertDataFromAudioBufferList:ioData
+ withNumberOfFrames:frames
+ toFloatBuffers:output.info->floatData];
+ [output.delegate output:output
+ playedAudio:output.info->floatData
+ withBufferSize:inNumberFrames
+ withNumberOfChannels:output.info->clientFormat.mChannelsPerFrame];
+ }
+ }
+ return noErr;
+}
\ No newline at end of file
--- /dev/null
+//
+// EZPlot.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 11/24/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Enumerations
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Plot Types
+///-----------------------------------------------------------
+
+/**
+ The types of plots that can be displayed in the view using the data.
+ */
+typedef NS_ENUM(NSInteger, EZPlotType)
+{
+ /**
+ Plot that displays only the samples of the current buffer
+ */
+ EZPlotTypeBuffer,
+
+ /**
+ Plot that displays a rolling history of values using the RMS calculated for each incoming buffer
+ */
+ EZPlotTypeRolling
+};
+
+/**
+ EZPlot is a cross-platform (iOS and OSX) class used to subclass the default view type (either UIView or NSView, respectively).
+
+ ## Subclassing Notes
+
+ This class isn't meant to be directly used in practice, but instead establishes the default properties and behaviors subclasses should obey to provide consistent behavior accross multiple types of graphs (i.e. set background color, plot type, should fill in, etc.). Subclasses should make use of the inherited properties from this class to allow all child plots to benefit from the same
+ */
+#if TARGET_OS_IPHONE
+#import <UIKit/UIKit.h>
+@interface EZPlot : UIView
+#elif TARGET_OS_MAC
+#import <Cocoa/Cocoa.h>
+@interface EZPlot : NSView
+#endif
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Customizing The Plot's Appearance
+///-----------------------------------------------------------
+/**
+ 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 black.
+ */
+#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 red.
+ */
+#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) IBInspectable float gain;
+
+/**
+ The type of plot as specified by the `EZPlotType` enumeration (i.e. a buffer or rolling plot type).
+ */
+@property (nonatomic, assign) IBInspectable EZPlotType plotType;
+
+/**
+ A boolean 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).
+ */
+@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.
+ */
+@property (nonatomic, assign) IBInspectable BOOL shouldMirror;
+
+//------------------------------------------------------------------------------
+#pragma mark - Clearing
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Clearing The Plot
+///-----------------------------------------------------------
+
+/**
+ Clears all data from the audio plot (includes both EZPlotTypeBuffer and EZPlotTypeRolling)
+ */
+-(void)clear;
+
+//------------------------------------------------------------------------------
+#pragma mark - Get Samples
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Updating The Plot
+///-----------------------------------------------------------
+
+/**
+ Updates the plot with the new buffer data and tells the view to redraw itself. Caller will provide a float array with the values they expect to see on the y-axis. The plot will internally handle mapping the x-axis and y-axis to the current view port, any interpolation for fills effects, and mirroring.
+ @param buffer A float array of values to map to the y-axis.
+ @param bufferSize The size of the float array that will be mapped to the y-axis.
+ @warning The bufferSize is expected to be the same, constant value once initial triggered. For plots using OpenGL a vertex buffer object will be allocated with a maximum buffersize of (2 * the initial given buffer size) to account for any interpolation necessary for filling in the graph. Updates use the glBufferSubData(...) function, which will crash if the buffersize exceeds the initial maximum allocated size.
+ */
+-(void)updateBuffer:(float *)buffer withBufferSize:(UInt32)bufferSize;
+
+@end
--- /dev/null
+//
+// EZPlot.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 11/24/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZPlot.h"
+
+@implementation EZPlot
+
+#pragma mark - Clearing
+-(void)clear
+{
+ // Override in subclass
+}
+
+#pragma mark - Get Samples
+-(void)updateBuffer:(float *)buffer
+ withBufferSize:(UInt32)bufferSize
+{
+ // Override in subclass
+}
+
+@end
--- /dev/null
+//
+// EZRecorder.h
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Foundation/Foundation.h>
+#import <AudioToolbox/AudioToolbox.h>
+
+@class EZRecorder;
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+/**
+ To ensure valid recording formats are used when recording to a file the EZRecorderFileType describes the most common file types that a file can be encoded in. Each of these types can be used to output recordings as such:
+
+ EZRecorderFileTypeAIFF - .aif, .aiff, .aifc, .aac
+ EZRecorderFileTypeM4A - .m4a, .mp4
+ EZRecorderFileTypeWAV - .wav
+
+ */
+typedef NS_ENUM(NSInteger, EZRecorderFileType)
+{
+ /**
+ Recording format that describes AIFF file types. These are uncompressed, LPCM files that are completely lossless, but are large in file size.
+ */
+ EZRecorderFileTypeAIFF,
+ /**
+ Recording format that describes M4A file types. These are compressed, but yield great results especially when file size is an issue.
+ */
+ EZRecorderFileTypeM4A,
+ /**
+ Recording format that describes WAV file types. These are uncompressed, LPCM files that are completely lossless, but are large in file size.
+ */
+ EZRecorderFileTypeWAV
+};
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorderDelegate
+//------------------------------------------------------------------------------
+
+/**
+ The EZRecorderDelegate for the EZRecorder provides a receiver for write events, `recorderUpdatedCurrentTime:`, and the close event, `recorderDidClose:`.
+ */
+@protocol EZRecorderDelegate <NSObject>
+
+@optional
+
+/**
+ Triggers when the EZRecorder is explicitly closed with the `closeAudioFile` method.
+ @param recorder The EZRecorder instance that triggered the action
+ */
+- (void)recorderDidClose:(EZRecorder *)recorder;
+
+/**
+ Triggers after the EZRecorder has successfully written audio data from the `appendDataFromBufferList:withBufferSize:` method.
+ @param recorder The EZRecorder instance that triggered the action
+ */
+- (void)recorderUpdatedCurrentTime:(EZRecorder *)recorder;
+
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorder
+//------------------------------------------------------------------------------
+
+/**
+ The EZRecorder provides a flexible way to create an audio file and append raw audio data to it. The EZRecorder will convert the incoming audio on the fly to the destination format so no conversion is needed between this and any other component. Right now the only supported output format is 'caf'. Each output file should have its own EZRecorder instance (think 1 EZRecorder = 1 audio file).
+ */
+@interface EZRecorder : NSObject
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+/**
+ An EZRecorderDelegate to listen for the write and close events.
+ */
+@property (nonatomic, weak) id<EZRecorderDelegate> delegate;
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Initializers
+///-----------------------------------------------------------
+
+/**
+ Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @return A newly created EZRecorder instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint, as well as a delegate to respond to the recorder's write and close events.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
+ @return A newly created EZRecorder instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+ delegate:(id<EZRecorderDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), and an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType).
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
+ @param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
+ @return A newly created EZRecorder instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType), and delegate to respond to the recorder's write and close events.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
+ @param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
+ @param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
+ @return A newly created EZRecorder instance.
+ */
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+ delegate:(id<EZRecorderDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Creates a new instance of an EZRecorder using a destination file path URL and the source format of the incoming audio.
+ @param url An NSURL specifying the file path location of where the audio file should be written to.
+ @param sourceFormat The AudioStreamBasicDescription for the incoming audio that will be written to the file.
+ @param destinationFileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @deprecated This property is deprecated starting in version 0.8.0.
+ @note Please use `initWithURL:clientFormat:fileType:` initializer instead.
+ @return The newly created EZRecorder instance.
+ */
+- (instancetype)initWithDestinationURL:(NSURL*)url
+ sourceFormat:(AudioStreamBasicDescription)sourceFormat
+ destinationFileType:(EZRecorderFileType)destinationFileType __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Class Initializers
+///-----------------------------------------------------------
+
+/**
+ Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @return A newly created EZRecorder instance.
+ */
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), and a file type (see `EZRecorderFileType`) that will automatically create an internal `fileFormat` and audio file type hint, as well as a delegate to respond to the recorder's write and close events.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
+ @return A newly created EZRecorder instance.
+ */
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+ delegate:(id<EZRecorderDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), and an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType).
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
+ @param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
+ @return A newly created EZRecorder instance.
+ */
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to create an instance of the EZRecorder with a file path URL to write out the file to, a client format describing the in-application common format (see `clientFormat` for more info), a file format describing the destination format on disk (see `fileFormat` for more info), an audio file type (an AudioFileTypeID for Core Audio, not a EZRecorderFileType), and delegate to respond to the recorder's write and close events.
+ @param url An NSURL representing the file path the output file should be written
+ @param clientFormat An AudioStreamBasicDescription describing the in-applciation common format (always linear PCM)
+ @param fileFormat An AudioStreamBasicDescription describing the format of the audio being written to disk (MP3, AAC, WAV, etc)
+ @param audioFileTypeID An AudioFileTypeID that matches your fileFormat (i.e. kAudioFileM4AType for an M4A format)
+ @param delegate An EZRecorderDelegate to listen for the recorder's write and close events.
+ @return A newly created EZRecorder instance.
+ */
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+ delegate:(id<EZRecorderDelegate>)delegate;
+
+//------------------------------------------------------------------------------
+
+/**
+ Class method to create a new instance of an EZRecorder using a destination file path URL and the source format of the incoming audio.
+ @param url An NSURL specifying the file path location of where the audio file should be written to.
+ @param sourceFormat The AudioStreamBasicDescription for the incoming audio that will be written to the file (also called the `clientFormat`).
+ @param destinationFileType A constant described by the EZRecorderFileType that corresponds to the type of destination file that should be written. For instance, an AAC file written using an '.m4a' extension would correspond to EZRecorderFileTypeM4A. See EZRecorderFileType for all the constants and mapping combinations.
+ @return The newly created EZRecorder instance.
+ */
++ (instancetype)recorderWithDestinationURL:(NSURL*)url
+ sourceFormat:(AudioStreamBasicDescription)sourceFormat
+ destinationFileType:(EZRecorderFileType)destinationFileType __attribute__((deprecated));
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Getting The Recorder's Properties
+///-----------------------------------------------------------
+
+/**
+ Provides the common AudioStreamBasicDescription that will be used for in-app interaction. The recorder's format will be converted from this format to the `fileFormat`. For instance, the file on disk could be a 22.5 kHz, float format, but we might have an audio processing graph that has a 44.1 kHz, signed integer format that we'd like to interact with. The client format lets us set that 44.1 kHz format on the recorder to properly write samples from the graph out to the file in the desired destination format.
+ @warning This must be a linear PCM format!
+ @return An AudioStreamBasicDescription structure describing the format of the audio file.
+ */
+@property (readwrite) AudioStreamBasicDescription clientFormat;
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current write offset in the audio file as an NSTimeInterval (i.e. in seconds). When setting this it will determine the correct frame offset and perform a `seekToFrame` to the new time offset.
+ @warning Make sure the new current time offset is less than the `duration` or you will receive an invalid seek assertion.
+ */
+@property (readonly) NSTimeInterval currentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration of the audio file in seconds.
+ */
+@property (readonly) NSTimeInterval duration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the AudioStreamBasicDescription structure containing the format of the recorder's audio file.
+ @return An AudioStreamBasicDescription structure describing the format of the audio file.
+ */
+@property (readonly) AudioStreamBasicDescription fileFormat;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the current time as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedCurrentTime;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the duration as an NSString with the time format MM:SS.
+ */
+@property (readonly) NSString *formattedDuration;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the frame index (a.k.a the write positon) within the audio file as SInt64. This can be helpful when seeking through the audio file.
+ @return The current frame index within the audio file as a SInt64.
+ */
+@property (readonly) SInt64 frameIndex;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the total frame count of the recorder's audio file in the file format.
+ @return The total number of frames in the recorder in the AudioStreamBasicDescription representing the file format as a SInt64.
+ */
+@property (readonly) SInt64 totalFrames;
+
+//------------------------------------------------------------------------------
+
+/**
+ Provides the file path that's currently being used by the recorder.
+ @return The NSURL representing the file path of the recorder path being used for recording.
+ */
+- (NSURL *)url;
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Appending Data To The Recorder
+///-----------------------------------------------------------
+
+/**
+ Appends audio data to the tail of the output file from an AudioBufferList.
+ @param bufferList The AudioBufferList holding the audio data to append
+ @param bufferSize The size of each of the buffers in the buffer list.
+ */
+- (void)appendDataFromBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize;
+
+//------------------------------------------------------------------------------
+
+///-----------------------------------------------------------
+/// @name Closing The Recorder
+///-----------------------------------------------------------
+
+/**
+ Finishes writes to the recorder's audio file and closes it.
+ */
+- (void)closeAudioFile;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// EZRecorder.m
+// EZAudio
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Copyright (c) 2015 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "EZRecorder.h"
+#import "EZAudioUtilities.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Data Structures
+//------------------------------------------------------------------------------
+
+typedef struct
+{
+ AudioFileTypeID audioFileTypeID;
+ ExtAudioFileRef extAudioFileRef;
+ AudioStreamBasicDescription clientFormat;
+ BOOL closed;
+ CFURLRef fileURL;
+ AudioStreamBasicDescription fileFormat;
+} EZRecorderInfo;
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorder (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface EZRecorder ()
+@property (nonatomic, assign) EZRecorderInfo *info;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorder (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation EZRecorder
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ if (!self.info->closed)
+ {
+ [self closeAudioFile];
+ }
+ free(self.info);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Initializers
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+{
+ return [self initWithURL:url
+ clientFormat:clientFormat
+ fileType:fileType
+ delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+ delegate:(id<EZRecorderDelegate>)delegate
+{
+ AudioStreamBasicDescription fileFormat = [EZRecorder formatForFileType:fileType
+ withSourceFormat:clientFormat];
+ AudioFileTypeID audioFileTypeID = [EZRecorder fileTypeIdForFileType:fileType
+ withSourceFormat:clientFormat];
+ return [self initWithURL:url
+ clientFormat:clientFormat
+ fileFormat:fileFormat
+ audioFileTypeID:audioFileTypeID
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+{
+ return [self initWithURL:url
+ clientFormat:clientFormat
+ fileFormat:fileFormat
+ audioFileTypeID:audioFileTypeID
+ delegate:nil];
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+ delegate:(id<EZRecorderDelegate>)delegate
+{
+
+ self = [super init];
+ if (self)
+ {
+ // Set defaults
+ self.info = (EZRecorderInfo *)calloc(1, sizeof(EZRecorderInfo));
+ self.info->audioFileTypeID = audioFileTypeID;
+ self.info->fileURL = (__bridge CFURLRef)url;
+ self.info->clientFormat = clientFormat;
+ self.info->fileFormat = fileFormat;
+ self.delegate = delegate;
+ [self setup];
+ }
+ return self;
+}
+
+//------------------------------------------------------------------------------
+
+- (instancetype)initWithDestinationURL:(NSURL*)url
+ sourceFormat:(AudioStreamBasicDescription)sourceFormat
+ destinationFileType:(EZRecorderFileType)destinationFileType
+{
+ return [self initWithURL:url
+ clientFormat:sourceFormat
+ fileType:destinationFileType];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Initializers
+//------------------------------------------------------------------------------
+
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+{
+ return [[self alloc] initWithURL:url
+ clientFormat:clientFormat
+ fileType:fileType];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType
+ delegate:(id<EZRecorderDelegate>)delegate
+{
+ return [[self alloc] initWithURL:url
+ clientFormat:clientFormat
+ fileType:fileType
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+{
+ return [[self alloc] initWithURL:url
+ clientFormat:clientFormat
+ fileFormat:fileFormat
+ audioFileTypeID:audioFileTypeID];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID
+ delegate:(id<EZRecorderDelegate>)delegate
+{
+ return [[self alloc] initWithURL:url
+ clientFormat:clientFormat
+ fileFormat:fileFormat
+ audioFileTypeID:audioFileTypeID
+ delegate:delegate];
+}
+
+//------------------------------------------------------------------------------
+
++ (instancetype)recorderWithDestinationURL:(NSURL*)url
+ sourceFormat:(AudioStreamBasicDescription)sourceFormat
+ destinationFileType:(EZRecorderFileType)destinationFileType
+{
+ return [[EZRecorder alloc] initWithDestinationURL:url
+ sourceFormat:sourceFormat
+ destinationFileType:destinationFileType];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Class Methods
+//------------------------------------------------------------------------------
+
++ (AudioStreamBasicDescription)formatForFileType:(EZRecorderFileType)fileType
+ withSourceFormat:(AudioStreamBasicDescription)sourceFormat
+{
+ AudioStreamBasicDescription asbd;
+ switch (fileType)
+ {
+ case EZRecorderFileTypeAIFF:
+ asbd = [EZAudioUtilities AIFFFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
+ sampleRate:sourceFormat.mSampleRate];
+ break;
+ case EZRecorderFileTypeM4A:
+ asbd = [EZAudioUtilities M4AFormatWithNumberOfChannels:sourceFormat.mChannelsPerFrame
+ sampleRate:sourceFormat.mSampleRate];
+ break;
+
+ case EZRecorderFileTypeWAV:
+ asbd = [EZAudioUtilities stereoFloatInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
+ break;
+
+ default:
+ asbd = [EZAudioUtilities stereoCanonicalNonInterleavedFormatWithSampleRate:sourceFormat.mSampleRate];
+ break;
+ }
+ return asbd;
+}
+
+//------------------------------------------------------------------------------
+
++ (AudioFileTypeID)fileTypeIdForFileType:(EZRecorderFileType)fileType
+ withSourceFormat:(AudioStreamBasicDescription)sourceFormat
+{
+ AudioFileTypeID audioFileTypeID;
+ switch (fileType)
+ {
+ case EZRecorderFileTypeAIFF:
+ audioFileTypeID = kAudioFileAIFFType;
+ break;
+
+ case EZRecorderFileTypeM4A:
+ audioFileTypeID = kAudioFileM4AType;
+ break;
+
+ case EZRecorderFileTypeWAV:
+ audioFileTypeID = kAudioFileWAVEType;
+ break;
+
+ default:
+ audioFileTypeID = kAudioFileWAVEType;
+ break;
+ }
+ return audioFileTypeID;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setup
+{
+ // Finish filling out the destination format description
+ UInt32 propSize = sizeof(self.info->fileFormat);
+ [EZAudioUtilities checkResult:AudioFormatGetProperty(kAudioFormatProperty_FormatInfo,
+ 0,
+ NULL,
+ &propSize,
+ &self.info->fileFormat)
+ operation:"Failed to fill out rest of destination format"];
+
+ //
+ // Create the audio file
+ //
+ [EZAudioUtilities checkResult:ExtAudioFileCreateWithURL(self.info->fileURL,
+ self.info->audioFileTypeID,
+ &self.info->fileFormat,
+ NULL,
+ kAudioFileFlags_EraseFile,
+ &self.info->extAudioFileRef)
+ operation:"Failed to create audio file"];
+
+ //
+ // Set the client format
+ //
+ [self setClientFormat:self.info->clientFormat];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Events
+//------------------------------------------------------------------------------
+
+- (void)appendDataFromBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+{
+ //
+ // Make sure the audio file is not closed
+ //
+ NSAssert(!self.info->closed, @"Cannot append data when EZRecorder has been closed. You must create a new instance.;");
+
+ //
+ // Perform the write
+ //
+ [EZAudioUtilities checkResult:ExtAudioFileWrite(self.info->extAudioFileRef,
+ bufferSize,
+ bufferList)
+ operation:"Failed to write audio data to recorded audio file"];
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(recorderUpdatedCurrentTime:)])
+ {
+ [self.delegate recorderUpdatedCurrentTime:self];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)closeAudioFile
+{
+ if (!self.info->closed)
+ {
+ //
+ // Close, audio file can no longer be written to
+ //
+ [EZAudioUtilities checkResult:ExtAudioFileDispose(self.info->extAudioFileRef)
+ operation:"Failed to close audio file"];
+ self.info->closed = YES;
+
+ //
+ // Notify delegate
+ //
+ if ([self.delegate respondsToSelector:@selector(recorderDidClose:)])
+ {
+ [self.delegate recorderDidClose:self];
+ }
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Getters
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)clientFormat
+{
+ return self.info->clientFormat;
+}
+
+//-----------------------------------------------------------------------------
+
+- (NSTimeInterval)currentTime
+{
+ NSTimeInterval currentTime = 0.0;
+ NSTimeInterval duration = [self duration];
+ if (duration != 0.0)
+ {
+ currentTime = (NSTimeInterval)[EZAudioUtilities MAP:(float)[self frameIndex]
+ leftMin:0.0f
+ leftMax:(float)[self totalFrames]
+ rightMin:0.0f
+ rightMax:duration];
+ }
+ return currentTime;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSTimeInterval)duration
+{
+ NSTimeInterval frames = (NSTimeInterval)[self totalFrames];
+ return (NSTimeInterval) frames / self.info->fileFormat.mSampleRate;
+}
+
+//------------------------------------------------------------------------------
+
+- (AudioStreamBasicDescription)fileFormat
+{
+ return self.info->fileFormat;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedCurrentTime
+{
+ return [EZAudioUtilities displayTimeStringFromSeconds:[self currentTime]];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)formattedDuration
+{
+ return [EZAudioUtilities displayTimeStringFromSeconds:[self duration]];
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)frameIndex
+{
+ SInt64 frameIndex;
+ [EZAudioUtilities checkResult:ExtAudioFileTell(self.info->extAudioFileRef,
+ &frameIndex)
+ operation:"Failed to get frame index"];
+ return frameIndex;
+}
+
+//------------------------------------------------------------------------------
+
+- (SInt64)totalFrames
+{
+ SInt64 totalFrames;
+ UInt32 propSize = sizeof(SInt64);
+ [EZAudioUtilities checkResult:ExtAudioFileGetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_FileLengthFrames,
+ &propSize,
+ &totalFrames)
+ operation:"Recorder failed to get total frames."];
+ return totalFrames;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSURL *)url
+{
+ return (__bridge NSURL*)self.info->fileURL;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setters
+//------------------------------------------------------------------------------
+
+- (void)setClientFormat:(AudioStreamBasicDescription)clientFormat
+{
+ [EZAudioUtilities checkResult:ExtAudioFileSetProperty(self.info->extAudioFileRef,
+ kExtAudioFileProperty_ClientDataFormat,
+ sizeof(clientFormat),
+ &clientFormat)
+ operation:"Failed to set client format on recorded audio file"];
+ self.info->clientFormat = clientFormat;
+}
+
+@end
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>$(CURRENT_PROJECT_VERSION)</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+//
+// TPCircularBuffer.c
+// Circular/Ring buffer implementation
+//
+// https://github.com/michaeltyson/TPCircularBuffer
+//
+// Created by Michael Tyson on 10/12/2011.
+//
+// Copyright (C) 2012-2013 A Tasty Pixel
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#include "TPCircularBuffer.h"
+#include <mach/mach.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#define reportResult(result,operation) (_reportResult((result),(operation),strrchr(__FILE__, '/')+1,__LINE__))
+static inline bool _reportResult(kern_return_t result, const char *operation, const char* file, int line) {
+ if ( result != ERR_SUCCESS ) {
+ printf("%s:%d: %s: %s\n", file, line, operation, mach_error_string(result));
+ return false;
+ }
+ return true;
+}
+
+bool _TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length, size_t structSize) {
+
+ assert(length > 0);
+
+ if ( structSize != sizeof(TPCircularBuffer) ) {
+ fprintf(stderr, "TPCircularBuffer: Header version mismatch. Check for old versions of TPCircularBuffer in your project\n");
+ abort();
+ }
+
+ // Keep trying until we get our buffer, needed to handle race conditions
+ int retries = 3;
+ while ( true ) {
+
+ buffer->length = (int32_t)round_page(length); // We need whole page sizes
+
+ // Temporarily allocate twice the length, so we have the contiguous address space to
+ // support a second instance of the buffer directly after
+ vm_address_t bufferAddress;
+ kern_return_t result = vm_allocate(mach_task_self(),
+ &bufferAddress,
+ buffer->length * 2,
+ VM_FLAGS_ANYWHERE); // allocate anywhere it'll fit
+ if ( result != ERR_SUCCESS ) {
+ if ( retries-- == 0 ) {
+ reportResult(result, "Buffer allocation");
+ return false;
+ }
+ // Try again if we fail
+ continue;
+ }
+
+ // Now replace the second half of the allocation with a virtual copy of the first half. Deallocate the second half...
+ result = vm_deallocate(mach_task_self(),
+ bufferAddress + buffer->length,
+ buffer->length);
+ if ( result != ERR_SUCCESS ) {
+ if ( retries-- == 0 ) {
+ reportResult(result, "Buffer deallocation");
+ return false;
+ }
+ // If this fails somehow, deallocate the whole region and try again
+ vm_deallocate(mach_task_self(), bufferAddress, buffer->length);
+ continue;
+ }
+
+ // Re-map the buffer to the address space immediately after the buffer
+ vm_address_t virtualAddress = bufferAddress + buffer->length;
+ vm_prot_t cur_prot, max_prot;
+ result = vm_remap(mach_task_self(),
+ &virtualAddress, // mirror target
+ buffer->length, // size of mirror
+ 0, // auto alignment
+ 0, // force remapping to virtualAddress
+ mach_task_self(), // same task
+ bufferAddress, // mirror source
+ 0, // MAP READ-WRITE, NOT COPY
+ &cur_prot, // unused protection struct
+ &max_prot, // unused protection struct
+ VM_INHERIT_DEFAULT);
+ if ( result != ERR_SUCCESS ) {
+ if ( retries-- == 0 ) {
+ reportResult(result, "Remap buffer memory");
+ return false;
+ }
+ // If this remap failed, we hit a race condition, so deallocate and try again
+ vm_deallocate(mach_task_self(), bufferAddress, buffer->length);
+ continue;
+ }
+
+ if ( virtualAddress != bufferAddress+buffer->length ) {
+ // If the memory is not contiguous, clean up both allocated buffers and try again
+ if ( retries-- == 0 ) {
+ printf("Couldn't map buffer memory to end of buffer\n");
+ return false;
+ }
+
+ vm_deallocate(mach_task_self(), virtualAddress, buffer->length);
+ vm_deallocate(mach_task_self(), bufferAddress, buffer->length);
+ continue;
+ }
+
+ buffer->buffer = (void*)bufferAddress;
+ buffer->fillCount = 0;
+ buffer->head = buffer->tail = 0;
+ buffer->atomic = true;
+
+ return true;
+ }
+ return false;
+}
+
+void TPCircularBufferCleanup(TPCircularBuffer *buffer) {
+ vm_deallocate(mach_task_self(), (vm_address_t)buffer->buffer, buffer->length * 2);
+ memset(buffer, 0, sizeof(TPCircularBuffer));
+}
+
+void TPCircularBufferClear(TPCircularBuffer *buffer) {
+ int32_t fillCount;
+ if ( TPCircularBufferTail(buffer, &fillCount) ) {
+ TPCircularBufferConsume(buffer, fillCount);
+ }
+}
+
+void TPCircularBufferSetAtomic(TPCircularBuffer *buffer, bool atomic) {
+ buffer->atomic = atomic;
+}
--- /dev/null
+//
+// TPCircularBuffer.h
+// Circular/Ring buffer implementation
+//
+// https://github.com/michaeltyson/TPCircularBuffer
+//
+// Created by Michael Tyson on 10/12/2011.
+//
+//
+// This implementation makes use of a virtual memory mapping technique that inserts a virtual copy
+// of the buffer memory directly after the buffer's end, negating the need for any buffer wrap-around
+// logic. Clients can simply use the returned memory address as if it were contiguous space.
+//
+// The implementation is thread-safe in the case of a single producer and single consumer.
+//
+// Virtual memory technique originally proposed by Philip Howard (http://vrb.slashusr.org/), and
+// adapted to Darwin by Kurt Revis (http://www.snoize.com,
+// http://www.snoize.com/Code/PlayBufferedSoundFile.tar.gz)
+//
+//
+// Copyright (C) 2012-2013 A Tasty Pixel
+//
+// This software is provided 'as-is', without any express or implied
+// warranty. In no event will the authors be held liable for any damages
+// arising from the use of this software.
+//
+// Permission is granted to anyone to use this software for any purpose,
+// including commercial applications, and to alter it and redistribute it
+// freely, subject to the following restrictions:
+//
+// 1. The origin of this software must not be misrepresented; you must not
+// claim that you wrote the original software. If you use this software
+// in a product, an acknowledgment in the product documentation would be
+// appreciated but is not required.
+//
+// 2. Altered source versions must be plainly marked as such, and must not be
+// misrepresented as being the original software.
+//
+// 3. This notice may not be removed or altered from any source distribution.
+//
+
+#ifndef TPCircularBuffer_h
+#define TPCircularBuffer_h
+
+#include <libkern/OSAtomic.h>
+#include <string.h>
+#include <assert.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct {
+ void *buffer;
+ int32_t length;
+ int32_t tail;
+ int32_t head;
+ volatile int32_t fillCount;
+ bool atomic;
+} TPCircularBuffer;
+
+/*!
+ * Initialise buffer
+ *
+ * Note that the length is advisory only: Because of the way the
+ * memory mirroring technique works, the true buffer length will
+ * be multiples of the device page size (e.g. 4096 bytes)
+ *
+ * @param buffer Circular buffer
+ * @param length Length of buffer
+ */
+#define TPCircularBufferInit(buffer, length) \
+ _TPCircularBufferInit(buffer, length, sizeof(*buffer))
+bool _TPCircularBufferInit(TPCircularBuffer *buffer, int32_t length, size_t structSize);
+
+/*!
+ * Cleanup buffer
+ *
+ * Releases buffer resources.
+ */
+void TPCircularBufferCleanup(TPCircularBuffer *buffer);
+
+/*!
+ * Clear buffer
+ *
+ * Resets buffer to original, empty state.
+ *
+ * This is safe for use by consumer while producer is accessing
+ * buffer.
+ */
+void TPCircularBufferClear(TPCircularBuffer *buffer);
+
+/*!
+ * Set the atomicity
+ *
+ * If you set the atomiticy to false using this method, the buffer will
+ * not use atomic operations. This can be used to give the compiler a little
+ * more optimisation opportunities when the buffer is only used on one thread.
+ *
+ * Important note: Only set this to false if you know what you're doing!
+ *
+ * The default value is true (the buffer will use atomic operations)
+ *
+ * @param buffer Circular buffer
+ * @param atomic Whether the buffer is atomic (default true)
+ */
+void TPCircularBufferSetAtomic(TPCircularBuffer *buffer, bool atomic);
+
+// Reading (consuming)
+
+/*!
+ * Access end of buffer
+ *
+ * This gives you a pointer to the end of the buffer, ready
+ * for reading, and the number of available bytes to read.
+ *
+ * @param buffer Circular buffer
+ * @param availableBytes On output, the number of bytes ready for reading
+ * @return Pointer to the first bytes ready for reading, or NULL if buffer is empty
+ */
+static __inline__ __attribute__((always_inline)) void* TPCircularBufferTail(TPCircularBuffer *buffer, int32_t* availableBytes) {
+ *availableBytes = buffer->fillCount;
+ if ( *availableBytes == 0 ) return NULL;
+ return (void*)((char*)buffer->buffer + buffer->tail);
+}
+
+/*!
+ * Consume bytes in buffer
+ *
+ * This frees up the just-read bytes, ready for writing again.
+ *
+ * @param buffer Circular buffer
+ * @param amount Number of bytes to consume
+ */
+static __inline__ __attribute__((always_inline)) void TPCircularBufferConsume(TPCircularBuffer *buffer, int32_t amount) {
+ buffer->tail = (buffer->tail + amount) % buffer->length;
+ if ( buffer->atomic ) {
+ OSAtomicAdd32Barrier(-amount, &buffer->fillCount);
+ } else {
+ buffer->fillCount -= amount;
+ }
+ assert(buffer->fillCount >= 0);
+}
+
+/*!
+ * Access front of buffer
+ *
+ * This gives you a pointer to the front of the buffer, ready
+ * for writing, and the number of available bytes to write.
+ *
+ * @param buffer Circular buffer
+ * @param availableBytes On output, the number of bytes ready for writing
+ * @return Pointer to the first bytes ready for writing, or NULL if buffer is full
+ */
+static __inline__ __attribute__((always_inline)) void* TPCircularBufferHead(TPCircularBuffer *buffer, int32_t* availableBytes) {
+ *availableBytes = (buffer->length - buffer->fillCount);
+ if ( *availableBytes == 0 ) return NULL;
+ return (void*)((char*)buffer->buffer + buffer->head);
+}
+
+// Writing (producing)
+
+/*!
+ * Produce bytes in buffer
+ *
+ * This marks the given section of the buffer ready for reading.
+ *
+ * @param buffer Circular buffer
+ * @param amount Number of bytes to produce
+ */
+static __inline__ __attribute__((always_inline)) void TPCircularBufferProduce(TPCircularBuffer *buffer, int32_t amount) {
+ buffer->head = (buffer->head + amount) % buffer->length;
+ if ( buffer->atomic ) {
+ OSAtomicAdd32Barrier(amount, &buffer->fillCount);
+ } else {
+ buffer->fillCount += amount;
+ }
+ assert(buffer->fillCount <= buffer->length);
+}
+
+/*!
+ * Helper routine to copy bytes to buffer
+ *
+ * This copies the given bytes to the buffer, and marks them ready for reading.
+ *
+ * @param buffer Circular buffer
+ * @param src Source buffer
+ * @param len Number of bytes in source buffer
+ * @return true if bytes copied, false if there was insufficient space
+ */
+static __inline__ __attribute__((always_inline)) bool TPCircularBufferProduceBytes(TPCircularBuffer *buffer, const void* src, int32_t len) {
+ int32_t space;
+ void *ptr = TPCircularBufferHead(buffer, &space);
+ if ( space < len ) return false;
+ memcpy(ptr, src, len);
+ TPCircularBufferProduce(buffer, len);
+ return true;
+}
+
+/*!
+ * Deprecated method
+ */
+static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferConsume instead")
+void TPCircularBufferConsumeNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
+ buffer->tail = (buffer->tail + amount) % buffer->length;
+ buffer->fillCount -= amount;
+ assert(buffer->fillCount >= 0);
+}
+
+/*!
+ * Deprecated method
+ */
+static __inline__ __attribute__((always_inline)) __deprecated_msg("use TPCircularBufferSetAtomic(false) and TPCircularBufferProduce instead")
+void TPCircularBufferProduceNoBarrier(TPCircularBuffer *buffer, int32_t amount) {
+ buffer->head = (buffer->head + amount) % buffer->length;
+ buffer->fillCount += amount;
+ assert(buffer->fillCount <= buffer->length);
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 666062361C5421A400FB99FA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 666062351C5421A400FB99FA /* AppDelegate.m */; };
+ 666062391C5421A400FB99FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 666062381C5421A400FB99FA /* main.m */; };
+ 6660623B1C5421A400FB99FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 6660623A1C5421A400FB99FA /* Assets.xcassets */; };
+ 6660623E1C5421A400FB99FA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6660623C1C5421A400FB99FA /* MainMenu.xib */; };
+ 6660624B1C54242100FB99FA /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6660624A1C54242100FB99FA /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DC41C54530A000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DC61C54530A000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+ 666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreGraphicsWaveform.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 666062341C5421A400FB99FA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 666062351C5421A400FB99FA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 666062381C5421A400FB99FA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 6660623A1C5421A400FB99FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 6660623D1C5421A400FB99FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 6660623F1C5421A400FB99FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 6660624A1C54242100FB99FA /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 6660622E1C5421A400FB99FA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6660624B1C54242100FB99FA /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374DC01C54530A000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DC51C54530A000B19D0 /* EZAudioiOS.framework */,
+ 66374DC71C54530A000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 666062281C5421A400FB99FA = {
+ isa = PBXGroup;
+ children = (
+ 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */,
+ 666062331C5421A400FB99FA /* CoreGraphicsWaveform */,
+ 6660624C1C54244900FB99FA /* Frameworks */,
+ 666062321C5421A400FB99FA /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 666062321C5421A400FB99FA /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 666062331C5421A400FB99FA /* CoreGraphicsWaveform */ = {
+ isa = PBXGroup;
+ children = (
+ 666062341C5421A400FB99FA /* AppDelegate.h */,
+ 666062351C5421A400FB99FA /* AppDelegate.m */,
+ 6660623A1C5421A400FB99FA /* Assets.xcassets */,
+ 6660623C1C5421A400FB99FA /* MainMenu.xib */,
+ 6660623F1C5421A400FB99FA /* Info.plist */,
+ 666062371C5421A400FB99FA /* Supporting Files */,
+ );
+ path = CoreGraphicsWaveform;
+ sourceTree = "<group>";
+ };
+ 666062371C5421A400FB99FA /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 666062381C5421A400FB99FA /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 6660624C1C54244900FB99FA /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 6660624A1C54242100FB99FA /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 666062301C5421A400FB99FA /* CoreGraphicsWaveform */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 666062421C5421A400FB99FA /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */;
+ buildPhases = (
+ 6660622D1C5421A400FB99FA /* Sources */,
+ 6660622E1C5421A400FB99FA /* Frameworks */,
+ 6660622F1C5421A400FB99FA /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = CoreGraphicsWaveform;
+ productName = CoreGraphicsWaveform;
+ productReference = 666062311C5421A400FB99FA /* CoreGraphicsWaveform.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 666062291C5421A400FB99FA /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 666062301C5421A400FB99FA = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 6660622C1C5421A400FB99FA /* Build configuration list for PBXProject "CoreGraphicsWaveform" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 666062281C5421A400FB99FA;
+ productRefGroup = 666062321C5421A400FB99FA /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DC01C54530A000B19D0 /* Products */;
+ ProjectRef = 66374DBF1C54530A000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 666062301C5421A400FB99FA /* CoreGraphicsWaveform */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DC51C54530A000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DC41C54530A000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DC71C54530A000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DC61C54530A000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 6660622F1C5421A400FB99FA /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6660623B1C5421A400FB99FA /* Assets.xcassets in Resources */,
+ 6660623E1C5421A400FB99FA /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 6660622D1C5421A400FB99FA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 666062391C5421A400FB99FA /* main.m in Sources */,
+ 666062361C5421A400FB99FA /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 6660623C1C5421A400FB99FA /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 6660623D1C5421A400FB99FA /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 666062401C5421A400FB99FA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 666062411C5421A400FB99FA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 666062431C5421A400FB99FA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 666062441C5421A400FB99FA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 6660622C1C5421A400FB99FA /* Build configuration list for PBXProject "CoreGraphicsWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 666062401C5421A400FB99FA /* Debug */,
+ 666062411C5421A400FB99FA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 666062421C5421A400FB99FA /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 666062431C5421A400FB99FA /* Debug */,
+ 666062441C5421A400FB99FA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 666062291C5421A400FB99FA /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZMicrophoneDelegate, NSApplicationDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (assign) IBOutlet NSWindow *window;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *audioPlot;
+
+//
+// The microphone
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//
+// The microphone pop up button (contains the menu for choosing a microphone
+// input)
+//
+@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputPopUpButton;
+
+//
+// The microphone input channel pop up button (contains the menu for choosing a
+// microphone input channel)
+//
+@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
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+-(IBAction)changePlotType:(id)sender;
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details)
+//
+-(IBAction)toggleMicrophone:(id)sender;
+
+@end
--- /dev/null
+//
+// AppDelegate.m
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize The Plot's Appearance
+//------------------------------------------------------------------------------
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ //
+ // Set plot's background color
+ //
+ self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.984 green: 0.471 blue: 0.525 alpha: 1];
+
+ //
+ // Set plot's waveform color
+ //
+ self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+
+ //
+ // Plot type (buffer means real-time, rolling is over time)
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Create the microphone
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void) reloadMicrophoneInputPopUpButtonMenu
+{
+ NSArray *inputDevices = [EZAudioDevice inputDevices];
+ NSMenu *menu = [[NSMenu alloc] init];
+ NSMenuItem *defaultInputMenuItem;
+ for (EZAudioDevice *device in inputDevices)
+ {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:device.name
+ action:@selector(changedInput:)
+ keyEquivalent:@""];
+ item.representedObject = device;
+ item.target = self;
+ [menu addItem:item];
+
+ // If this device is the same one the microphone is using then
+ // we will use this menu item as the currently selected item
+ // in the microphone input popup button's list of items. For instance,
+ // if you are connected to an external display by default the external
+ // display's microphone might be used instead of the mac's built in
+ // mic.
+ if ([device isEqual:self.microphone.device])
+ {
+ defaultInputMenuItem = item;
+ }
+ }
+ self.microphoneInputPopUpButton.menu = menu;
+
+ //
+ // Set the selected device to the current selection on the
+ // microphone input popup button
+ //
+ [self.microphoneInputPopUpButton selectItem:defaultInputMenuItem];
+}
+
+//------------------------------------------------------------------------------
+
+- (void) reloadMicrophoneInputChannelPopUpButtonMenu
+{
+ NSMenu *menu = [[NSMenu alloc] init];
+ for (int i = 0; i < self.microphone.device.inputChannelCount; i++)
+ {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(i).stringValue
+ action:nil
+ keyEquivalent:@""];
+ [menu addItem:item];
+ }
+ self.microphoneInputChannelPopUpButton.menu = menu;
+ [self.microphoneInputChannelPopUpButton selectItemAtIndex:0];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changedInput:(id)sender
+{
+ EZAudioDevice *device = [sender representedObject];
+ [self.microphone setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegment];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ switch([sender state])
+ {
+ case NSOffState:
+ [self.microphone stopFetchingAudio];
+ break;
+ case NSOnState:
+ [self.microphone startFetchingAudio];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+/*
+ Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
+ */
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+/*
+ Give the classic mirrored, rolling waveform look
+ */
+- (void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+#pragma mark - EZMicrophoneDelegate
+#warning Thread Safety
+//
+// Note that any callback that provides streamed audio data (like streaming
+// microphone input) happens on a separate audio thread that should not be
+// blocked. When we feed audio data into any of the UI components we need to
+// explicity create a GCD block on the main thread to properly get the UI to
+// work.
+//
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // See the Thread Safety warning above, but in a nutshell these callbacks
+ // happen on a separate audio thread. We wrap any UI updating in a GCD block
+ // on the main thread to avoid blocking that audio flow.
+ //
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(),^{
+ //
+ // All the audio plot needs is the buffer data (float *) and the size.
+ // Internally the audio plot will handle all the drawing related code,
+ // history management, and freeing its own resources. Hence, one badass
+ // line of code gets you a pretty plot :)
+ //
+ NSInteger channel = [weakSelf.microphoneInputChannelPopUpButton indexOfSelectedItem];
+ [weakSelf.audioPlot updateBuffer:buffer[channel] withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ // The AudioStreamBasicDescription of the microphone stream. This is useful
+ // when configuring the EZRecorder or telling another component what audio
+ // format type to expect.
+
+ //
+ // Here's a print function to allow you to inspect it a little easier.
+ //
+ [EZAudioUtilities printASBD:audioStreamBasicDescription];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as a buffer list that can be directly fed into
+ // the EZRecorder or EZOutput. Say whattt...
+ //
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ changedDevice:(EZAudioDevice *)device
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ //
+ // Set up the microphone input popup button's items to select
+ // between different microphone inputs
+ //
+ [weakSelf reloadMicrophoneInputPopUpButtonMenu];
+
+ //
+ // Set up the microphone input popup button's items to select
+ // between different microphone input channels
+ //
+ [weakSelf reloadMicrophoneInputChannelPopUpButtonMenu];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (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
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlot" destination="UKU-Zt-VNI" id="VZE-Q5-pWX"/>
+ <outlet property="microphoneInputChannelPopUpButton" destination="eQn-G8-sEy" id="t6L-MA-Ir9"/>
+ <outlet property="microphoneInputPopUpButton" destination="iw4-UD-y2x" id="u5y-KI-fWu"/>
+ <outlet property="microphoneSwitch" destination="OcB-2r-09B" id="S6J-CM-twc"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="CoreGraphicsWaveform" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="CoreGraphicsWaveform" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About CoreGraphicsWaveform" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide CoreGraphicsWaveform" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit CoreGraphicsWaveform" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="CoreGraphicsWaveform Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="CoreGraphicsWaveform" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="UKU-Zt-VNI" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <subviews>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="OcB-2r-09B">
+ <rect key="frame" x="339" y="44" width="123" height="18"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="119" id="IYG-tU-wTC"/>
+ </constraints>
+ <buttonCell key="cell" type="check" title="Microphone On" bezelStyle="regularSquare" imagePosition="right" state="on" inset="2" id="nLI-9n-Lq4">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="toggleMicrophone:" target="Voe-Tx-rLC" id="owY-ee-pxT"/>
+ </connections>
+ </button>
+ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vg4-nF-3aC">
+ <rect key="frame" x="336" y="15" width="126" height="24"/>
+ <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="izG-Ud-yhj">
+ <font key="font" metaFont="system"/>
+ <segments>
+ <segment label="Buffer" selected="YES"/>
+ <segment label="Rolling" tag="1"/>
+ </segments>
+ </segmentedCell>
+ <connections>
+ <action selector="changePlotType:" target="Voe-Tx-rLC" id="tpI-pn-CXh"/>
+ </connections>
+ </segmentedControl>
+ <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="iw4-UD-y2x" userLabel="microphoneInputPopUpButton">
+ <rect key="frame" x="18" y="14" width="180" height="26"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="175" id="pXT-MN-bhv"/>
+ </constraints>
+ <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="NAH-si-Cz7" id="iUB-oI-R1w">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="qYP-H1-Bk6">
+ <items>
+ <menuItem title="Item 1" state="on" id="NAH-si-Cz7"/>
+ <menuItem title="Item 2" id="BXf-ml-R0L"/>
+ <menuItem title="Item 3" id="K8l-2q-4fM"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ </popUpButton>
+ <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="eQn-G8-sEy" userLabel="microphoneInputChannelPopUpButton">
+ <rect key="frame" x="204" y="14" width="79" height="26"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="74" id="YOF-2X-UV4"/>
+ </constraints>
+ <popUpButtonCell key="cell" type="push" title="1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="xFp-40-Dr9" id="BFV-5e-q9Y">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="iMm-fx-yJb">
+ <items>
+ <menuItem title="1" state="on" id="xFp-40-Dr9"/>
+ <menuItem title="Item 2" id="h5D-tQ-aWj"/>
+ <menuItem title="Item 3" id="KIX-gW-QNf"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ </popUpButton>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hQY-oe-OzP">
+ <rect key="frame" x="18" y="43" width="35" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="bY0-Zl-AT5">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ve4-EX-2la">
+ <rect key="frame" x="204" y="43" width="54" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="suO-Th-3jL">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="eQn-G8-sEy" secondAttribute="bottom" constant="17" id="3cy-PJ-m0Y"/>
+ <constraint firstItem="vg4-nF-3aC" firstAttribute="top" secondItem="OcB-2r-09B" secondAttribute="bottom" constant="8" id="9k9-TY-Bjf"/>
+ <constraint firstItem="vg4-nF-3aC" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="eQn-G8-sEy" secondAttribute="trailing" constant="11" id="M6I-rI-pcs"/>
+ <constraint firstAttribute="bottom" secondItem="iw4-UD-y2x" secondAttribute="bottom" constant="17" id="NZe-J3-FGY"/>
+ <constraint firstItem="eQn-G8-sEy" firstAttribute="leading" secondItem="ve4-EX-2la" secondAttribute="leading" id="URh-po-xQb"/>
+ <constraint firstItem="iw4-UD-y2x" firstAttribute="leading" secondItem="UKU-Zt-VNI" secondAttribute="leading" constant="20" id="YeT-tO-rG3"/>
+ <constraint firstAttribute="bottom" secondItem="vg4-nF-3aC" secondAttribute="bottom" constant="17" id="aid-He-3CY"/>
+ <constraint firstAttribute="trailing" secondItem="OcB-2r-09B" secondAttribute="trailing" constant="20" id="ceh-Ub-H3g"/>
+ <constraint firstItem="eQn-G8-sEy" firstAttribute="top" secondItem="ve4-EX-2la" secondAttribute="bottom" constant="5" id="enm-hh-fpR"/>
+ <constraint firstAttribute="trailing" secondItem="vg4-nF-3aC" secondAttribute="trailing" constant="20" id="kkp-oh-PX1"/>
+ <constraint firstItem="hQY-oe-OzP" firstAttribute="leading" secondItem="UKU-Zt-VNI" secondAttribute="leading" constant="20" id="ptg-v2-mao"/>
+ <constraint firstItem="eQn-G8-sEy" firstAttribute="leading" secondItem="iw4-UD-y2x" secondAttribute="trailing" constant="11" id="waP-mh-dlK"/>
+ <constraint firstItem="iw4-UD-y2x" firstAttribute="top" secondItem="hQY-oe-OzP" secondAttribute="bottom" constant="5" id="wzU-X6-aEB"/>
+ </constraints>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstItem="UKU-Zt-VNI" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="AgR-SX-Oic"/>
+ <constraint firstAttribute="bottom" secondItem="UKU-Zt-VNI" secondAttribute="bottom" id="XJr-UI-i7d"/>
+ <constraint firstItem="UKU-Zt-VNI" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="gOP-bJ-FcC"/>
+ <constraint firstAttribute="trailing" secondItem="UKU-Zt-VNI" secondAttribute="trailing" id="yV6-Vo-HHU"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="414" y="327"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "group:CoreGraphicsWaveform/CoreGraphicsWaveform.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:OpenGLWaveform/OpenGLWaveform.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:PlayFile/PlayFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:RecordFile/RecordFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:WaveformFromFile/WaveformFromFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:FFT/FFT.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:PassThrough/PassThrough.xcodeproj">
+ </FileRef>
+</Workspace>
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374D8D1C544D2E000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D8C1C544D2E000B19D0 /* AppDelegate.m */; };
+ 66374D901C544D2E000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D8F1C544D2E000B19D0 /* main.m */; };
+ 66374D921C544D2E000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374D911C544D2E000B19D0 /* Assets.xcassets */; };
+ 66374D951C544D2E000B19D0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66374D931C544D2E000B19D0 /* MainMenu.xib */; };
+ 66374D9D1C544D3F000B19D0 /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374D9C1C544D3F000B19D0 /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DE81C545318000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DE31C545318000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DEA1C545318000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DE31C545318000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374D881C544D2E000B19D0 /* FFT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FFT.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374D8B1C544D2E000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374D8C1C544D2E000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374D8F1C544D2E000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374D911C544D2E000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374D941C544D2E000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 66374D961C544D2E000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374D9C1C544D3F000B19D0 /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+ 66374DE31C545318000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374D851C544D2E000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D9D1C544D3F000B19D0 /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374D7F1C544D2E000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374DE31C545318000B19D0 /* EZAudio.xcodeproj */,
+ 66374D8A1C544D2E000B19D0 /* FFT */,
+ 66374D9E1C544E82000B19D0 /* Frameworks */,
+ 66374D891C544D2E000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374D891C544D2E000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D881C544D2E000B19D0 /* FFT.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374D8A1C544D2E000B19D0 /* FFT */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D8B1C544D2E000B19D0 /* AppDelegate.h */,
+ 66374D8C1C544D2E000B19D0 /* AppDelegate.m */,
+ 66374D911C544D2E000B19D0 /* Assets.xcassets */,
+ 66374D931C544D2E000B19D0 /* MainMenu.xib */,
+ 66374D961C544D2E000B19D0 /* Info.plist */,
+ 66374D8E1C544D2E000B19D0 /* Supporting Files */,
+ );
+ path = FFT;
+ sourceTree = "<group>";
+ };
+ 66374D8E1C544D2E000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D8F1C544D2E000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374D9E1C544E82000B19D0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D9C1C544D3F000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DE41C545318000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DE91C545318000B19D0 /* EZAudioiOS.framework */,
+ 66374DEB1C545318000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374D871C544D2E000B19D0 /* FFT */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374D991C544D2E000B19D0 /* Build configuration list for PBXNativeTarget "FFT" */;
+ buildPhases = (
+ 66374D841C544D2E000B19D0 /* Sources */,
+ 66374D851C544D2E000B19D0 /* Frameworks */,
+ 66374D861C544D2E000B19D0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = FFT;
+ productName = FFT;
+ productReference = 66374D881C544D2E000B19D0 /* FFT.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374D801C544D2E000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374D871C544D2E000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 66374D831C544D2E000B19D0 /* Build configuration list for PBXProject "FFT" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 66374D7F1C544D2E000B19D0;
+ productRefGroup = 66374D891C544D2E000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DE41C545318000B19D0 /* Products */;
+ ProjectRef = 66374DE31C545318000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374D871C544D2E000B19D0 /* FFT */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DE91C545318000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DE81C545318000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DEB1C545318000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DEA1C545318000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374D861C544D2E000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D921C544D2E000B19D0 /* Assets.xcassets in Resources */,
+ 66374D951C544D2E000B19D0 /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374D841C544D2E000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D901C544D2E000B19D0 /* main.m in Sources */,
+ 66374D8D1C544D2E000B19D0 /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 66374D931C544D2E000B19D0 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374D941C544D2E000B19D0 /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374D971C544D2E000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 66374D981C544D2E000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 66374D9A1C544D2E000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = FFT/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.FFT;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374D9B1C544D2E000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = FFT/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.FFT;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374D831C544D2E000B19D0 /* Build configuration list for PBXProject "FFT" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D971C544D2E000B19D0 /* Debug */,
+ 66374D981C544D2E000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374D991C544D2E000B19D0 /* Build configuration list for PBXNativeTarget "FFT" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D9A1C544D2E000B19D0 /* Debug */,
+ 66374D9B1C544D2E000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374D801C544D2E000B19D0 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZMicrophoneDelegate, EZAudioFFTDelegate, NSApplicationDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (weak) IBOutlet NSWindow *window;
+
+//
+// EZAudioPlot for frequency plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *audioPlotFreq;
+
+//
+// EZAudioPlot for time plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *audioPlotTime;
+
+//
+// A label used to display the maximum frequency (i.e. the frequency with
+// the highest energy) calculated from the FFT.
+//
+@property (nonatomic, weak) IBOutlet NSTextField *maxFrequencyLabel;
+
+//
+// The microphone used to get input.
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//
+// Used to calculate a rolling FFT of the incoming audio data.
+//
+@property (nonatomic, strong) EZAudioFFTRolling *fft;
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - Constants
+//------------------------------------------------------------------------------
+
+static vDSP_Length const FFTViewControllerFFTWindowSize = 4096;
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+- (void)awakeFromNib
+{
+ //
+ // Setup time domain audio plot
+ //
+ self.audioPlotTime.plotType = EZPlotTypeBuffer;
+
+ //
+ // Setup frequency domain audio plot
+ //
+ self.audioPlotFreq.shouldFill = YES;
+ self.audioPlotFreq.plotType = EZPlotTypeBuffer;
+ self.audioPlotFreq.shouldCenterYAxis = NO;
+
+ //
+ // Create an instance of the microphone and tell it to use this view controller instance as the delegate
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Create an instance of the EZAudioFFTRolling to keep a history of the incoming audio data and calculate the FFT.
+ //
+ self.fft = [EZAudioFFTRolling fftWithWindowSize:FFTViewControllerFFTWindowSize
+ sampleRate:self.microphone.audioStreamBasicDescription.mSampleRate
+ delegate:self];
+
+ //
+ // Start the mic
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+-(void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Calculate the FFT, will trigger EZAudioFFTDelegate
+ //
+ [self.fft computeFFTWithBuffer:buffer[0] withBufferSize:bufferSize];
+
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlotTime updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFTDelegate
+//------------------------------------------------------------------------------
+
+- (void) fft:(EZAudioFFT *)fft
+ updatedWithFFTData:(float *)fftData
+ bufferSize:(vDSP_Length)bufferSize
+{
+ float maxFrequency = [fft maxFrequency];
+ NSString *noteName = [EZAudioUtilities noteNameStringForFrequency:maxFrequency
+ includeOctave:YES];
+
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.maxFrequencyLabel.stringValue = [NSString stringWithFormat:@"Highest Note: %@,\nFrequency: %.2f", noteName, maxFrequency];
+ [weakSelf.audioPlotFreq updateBuffer:fftData withBufferSize:(UInt32)bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlotFreq" destination="bYU-wY-hDo" id="GIp-Pk-HtM"/>
+ <outlet property="audioPlotTime" destination="SUJ-Np-jlL" id="Dt9-qz-RbQ"/>
+ <outlet property="maxFrequencyLabel" destination="Vjf-P4-Me7" id="5Lx-gm-QId"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="FFT" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="FFT" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About FFT" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide FFT" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit FFT" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="FFT Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="FFT" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="bYU-wY-hDo" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="SUJ-Np-jlL" customClass="EZAudioPlot">
+ <rect key="frame" x="18" y="190" width="444" height="64"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="64" id="0kl-Pj-Sge"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="color" keyPath="color">
+ <color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </userDefinedRuntimeAttribute>
+ </userDefinedRuntimeAttributes>
+ </customView>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Vjf-P4-Me7">
+ <rect key="frame" x="16" y="159" width="4" height="22"/>
+ <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="V1O-MR-dks">
+ <font key="font" size="18" name="HelveticaNeue-Light"/>
+ <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="trailing" secondItem="SUJ-Np-jlL" secondAttribute="trailing" constant="18" id="8e6-wa-2iS"/>
+ <constraint firstItem="Vjf-P4-Me7" firstAttribute="leading" secondItem="bYU-wY-hDo" secondAttribute="leading" constant="18" id="8iO-u0-Hif"/>
+ <constraint firstItem="Vjf-P4-Me7" firstAttribute="top" secondItem="SUJ-Np-jlL" secondAttribute="bottom" constant="9" id="IoR-eV-hfX"/>
+ <constraint firstItem="SUJ-Np-jlL" firstAttribute="leading" secondItem="bYU-wY-hDo" secondAttribute="leading" constant="18" id="cjI-VW-eMW"/>
+ <constraint firstItem="SUJ-Np-jlL" firstAttribute="top" secondItem="bYU-wY-hDo" secondAttribute="top" constant="18" id="m9C-bU-rjo"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
+ <color key="value" red="0.0078431372550000003" green="0.72156862749999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
+ </userDefinedRuntimeAttribute>
+ <userDefinedRuntimeAttribute type="color" keyPath="color">
+ <color key="value" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </userDefinedRuntimeAttribute>
+ </userDefinedRuntimeAttributes>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstItem="bYU-wY-hDo" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="5z4-1k-1AB"/>
+ <constraint firstItem="bYU-wY-hDo" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="DTD-Tg-LKd"/>
+ <constraint firstAttribute="trailing" secondItem="bYU-wY-hDo" secondAttribute="trailing" id="dXG-Z8-3Xu"/>
+ <constraint firstAttribute="bottom" secondItem="bYU-wY-hDo" secondAttribute="bottom" id="tJa-lp-h1P"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="252" y="239"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// FFT
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 6660627E1C5427CC00FB99FA /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 6660627D1C5427CC00FB99FA /* AppDelegate.m */; };
+ 666062811C5427CC00FB99FA /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 666062801C5427CC00FB99FA /* main.m */; };
+ 666062831C5427CC00FB99FA /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 666062821C5427CC00FB99FA /* Assets.xcassets */; };
+ 666062861C5427CC00FB99FA /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 666062841C5427CC00FB99FA /* MainMenu.xib */; };
+ 6660629A1C5427F500FB99FA /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 666062991C5427F500FB99FA /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DCD1C545312000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DC81C545312000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DCF1C545312000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DC81C545312000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374DC81C545312000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+ 666062791C5427CC00FB99FA /* OpenGLWaveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenGLWaveform.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 6660627C1C5427CC00FB99FA /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 6660627D1C5427CC00FB99FA /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 666062801C5427CC00FB99FA /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 666062821C5427CC00FB99FA /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 666062851C5427CC00FB99FA /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 666062871C5427CC00FB99FA /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 666062991C5427F500FB99FA /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 666062761C5427CC00FB99FA /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6660629A1C5427F500FB99FA /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 662B6C4D1C542C4400353D48 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 666062991C5427F500FB99FA /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DC91C545312000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DCE1C545312000B19D0 /* EZAudioiOS.framework */,
+ 66374DD01C545312000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 666062701C5427CC00FB99FA = {
+ isa = PBXGroup;
+ children = (
+ 66374DC81C545312000B19D0 /* EZAudio.xcodeproj */,
+ 6660627B1C5427CC00FB99FA /* OpenGLWaveform */,
+ 662B6C4D1C542C4400353D48 /* Frameworks */,
+ 6660627A1C5427CC00FB99FA /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 6660627A1C5427CC00FB99FA /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 666062791C5427CC00FB99FA /* OpenGLWaveform.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 6660627B1C5427CC00FB99FA /* OpenGLWaveform */ = {
+ isa = PBXGroup;
+ children = (
+ 6660627C1C5427CC00FB99FA /* AppDelegate.h */,
+ 6660627D1C5427CC00FB99FA /* AppDelegate.m */,
+ 666062821C5427CC00FB99FA /* Assets.xcassets */,
+ 666062841C5427CC00FB99FA /* MainMenu.xib */,
+ 666062871C5427CC00FB99FA /* Info.plist */,
+ 6660627F1C5427CC00FB99FA /* Supporting Files */,
+ );
+ path = OpenGLWaveform;
+ sourceTree = "<group>";
+ };
+ 6660627F1C5427CC00FB99FA /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 666062801C5427CC00FB99FA /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 666062781C5427CC00FB99FA /* OpenGLWaveform */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 6660628A1C5427CC00FB99FA /* Build configuration list for PBXNativeTarget "OpenGLWaveform" */;
+ buildPhases = (
+ 666062751C5427CC00FB99FA /* Sources */,
+ 666062761C5427CC00FB99FA /* Frameworks */,
+ 666062771C5427CC00FB99FA /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = OpenGLWaveform;
+ productName = OpenGLWaveform;
+ productReference = 666062791C5427CC00FB99FA /* OpenGLWaveform.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 666062711C5427CC00FB99FA /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 666062781C5427CC00FB99FA = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 666062741C5427CC00FB99FA /* Build configuration list for PBXProject "OpenGLWaveform" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 666062701C5427CC00FB99FA;
+ productRefGroup = 6660627A1C5427CC00FB99FA /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DC91C545312000B19D0 /* Products */;
+ ProjectRef = 66374DC81C545312000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 666062781C5427CC00FB99FA /* OpenGLWaveform */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DCE1C545312000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DCD1C545312000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DD01C545312000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DCF1C545312000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 666062771C5427CC00FB99FA /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 666062831C5427CC00FB99FA /* Assets.xcassets in Resources */,
+ 666062861C5427CC00FB99FA /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 666062751C5427CC00FB99FA /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 666062811C5427CC00FB99FA /* main.m in Sources */,
+ 6660627E1C5427CC00FB99FA /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 666062841C5427CC00FB99FA /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 666062851C5427CC00FB99FA /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 666062881C5427CC00FB99FA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 666062891C5427CC00FB99FA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 6660628B1C5427CC00FB99FA /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = OpenGLWaveform/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.OpenGLWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 6660628C1C5427CC00FB99FA /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ INFOPLIST_FILE = OpenGLWaveform/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.OpenGLWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 666062741C5427CC00FB99FA /* Build configuration list for PBXProject "OpenGLWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 666062881C5427CC00FB99FA /* Debug */,
+ 666062891C5427CC00FB99FA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 6660628A1C5427CC00FB99FA /* Build configuration list for PBXNativeTarget "OpenGLWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 6660628B1C5427CC00FB99FA /* Debug */,
+ 6660628C1C5427CC00FB99FA /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 666062711C5427CC00FB99FA /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZMicrophoneDelegate, NSApplicationDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (weak) IBOutlet NSWindow *window;
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The OpenGL based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//
+// The microphone
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//
+// The microphone pop up button (contains the menu for choosing a microphone
+// input)
+//
+@property (nonatomic, weak) IBOutlet NSPopUpButton *microphoneInputPopUpButton;
+
+//
+// The microphone input channel pop up button (contains the menu for choosing a
+// microphone input channel)
+//
+@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
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+-(IBAction)changePlotType:(id)sender;
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details)
+//
+-(IBAction)toggleMicrophone:(id)sender;
+
+@end
--- /dev/null
+//
+// AppDelegate.m
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize The Plot's Appearance
+//------------------------------------------------------------------------------
+
+- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
+{
+ //
+ // Set plot's background color
+ //
+ self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.569 green: 0.82 blue: 0.478 alpha: 1];
+
+ //
+ // Set plot's waveform color
+ //
+ self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+
+ //
+ // Plot type (buffer means real-time, rolling is over time)
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Create the microphone
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void) reloadMicrophoneInputPopUpButtonMenu
+{
+ NSArray *inputDevices = [EZAudioDevice inputDevices];
+ NSMenu *menu = [[NSMenu alloc] init];
+ NSMenuItem *defaultInputMenuItem;
+ for (EZAudioDevice *device in inputDevices)
+ {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:device.name
+ action:@selector(changedInput:)
+ keyEquivalent:@""];
+ item.representedObject = device;
+ item.target = self;
+ [menu addItem:item];
+
+ // If this device is the same one the microphone is using then
+ // we will use this menu item as the currently selected item
+ // in the microphone input popup button's list of items. For instance,
+ // if you are connected to an external display by default the external
+ // display's microphone might be used instead of the mac's built in
+ // mic.
+ if ([device isEqual:self.microphone.device])
+ {
+ defaultInputMenuItem = item;
+ }
+ }
+ self.microphoneInputPopUpButton.menu = menu;
+
+ //
+ // Set the selected device to the current selection on the
+ // microphone input popup button
+ //
+ [self.microphoneInputPopUpButton selectItem:defaultInputMenuItem];
+}
+
+//------------------------------------------------------------------------------
+
+- (void) reloadMicrophoneInputChannelPopUpButtonMenu
+{
+ NSMenu *menu = [[NSMenu alloc] init];
+ for (int i = 0; i < self.microphone.device.inputChannelCount; i++)
+ {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:@(i).stringValue
+ action:nil
+ keyEquivalent:@""];
+ [menu addItem:item];
+ }
+ self.microphoneInputChannelPopUpButton.menu = menu;
+ [self.microphoneInputChannelPopUpButton selectItemAtIndex:0];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changedInput:(id)sender
+{
+ EZAudioDevice *device = [sender representedObject];
+ [self.microphone setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegment];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ switch([sender state])
+ {
+ case NSOffState:
+ [self.microphone stopFetchingAudio];
+ break;
+ case NSOnState:
+ [self.microphone startFetchingAudio];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+/*
+ Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
+ */
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+/*
+ Give the classic mirrored, rolling waveform look
+ */
+- (void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+#pragma mark - EZMicrophoneDelegate
+#warning Thread Safety
+//
+// Note that any callback that provides streamed audio data (like streaming
+// microphone input) happens on a separate audio thread that should not be
+// blocked. When we feed audio data into any of the UI components we need to
+// explicity create a GCD block on the main thread to properly get the UI to
+// work.
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // See the Thread Safety warning above, but in a nutshell these callbacks
+ // happen on a separate audio thread. We wrap any UI updating in a GCD block
+ // on the main thread to avoid blocking that audio flow.
+ //
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(),^{
+ //
+ // All the audio plot needs is the buffer data (float *) and the size.
+ // Internally the audio plot will handle all the drawing related code,
+ // history management, and freeing its own resources. Hence, one badass
+ // line of code gets you a pretty plot :)
+ //
+ NSInteger channel = [weakSelf.microphoneInputChannelPopUpButton indexOfSelectedItem];
+ [weakSelf.audioPlot updateBuffer:buffer[channel] withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ // The AudioStreamBasicDescription of the microphone stream. This is useful
+ // when configuring the EZRecorder or telling another component what audio
+ // format type to expect.
+
+ //
+ // Here's a print function to allow you to inspect it a little easier.
+ //
+ [EZAudioUtilities printASBD:audioStreamBasicDescription];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as a buffer list that can be directly fed into
+ // the EZRecorder or EZOutput. Say whattt...
+ //
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ changedDevice:(EZAudioDevice *)device
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ //
+ // Set up the microphone input popup button's items to select
+ // between different microphone inputs
+ //
+ [weakSelf reloadMicrophoneInputPopUpButtonMenu];
+
+ //
+ // Set up the microphone input popup button's items to select
+ // between different microphone input channels
+ //
+ [weakSelf reloadMicrophoneInputChannelPopUpButtonMenu];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (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
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlot" destination="9NH-Rm-uCu" id="mOV-PE-eaU"/>
+ <outlet property="microphoneInputChannelPopUpButton" destination="3xi-d5-sVw" id="tbg-Sb-Vaa"/>
+ <outlet property="microphoneInputPopUpButton" destination="IVu-IX-YDR" id="UWQ-yh-Elg"/>
+ <outlet property="microphoneSwitch" destination="CoM-zD-tS8" id="QTf-6I-8BZ"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="OpenGLWaveform" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="OpenGLWaveform" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About OpenGLWaveform" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide OpenGLWaveform" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit OpenGLWaveform" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="OpenGLWaveform Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="OpenGLWaveform" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="9NH-Rm-uCu" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <subviews>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="CoM-zD-tS8">
+ <rect key="frame" x="339" y="47" width="123" height="18"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="119" id="Oho-fd-7LV"/>
+ </constraints>
+ <buttonCell key="cell" type="check" title="Microphone On" bezelStyle="regularSquare" imagePosition="right" state="on" inset="2" id="eRJ-le-Yky">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ </button>
+ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="bZa-Zb-t7u">
+ <rect key="frame" x="336" y="18" width="126" height="24"/>
+ <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="lgi-Ks-a8r">
+ <font key="font" metaFont="system"/>
+ <segments>
+ <segment label="Buffer" selected="YES"/>
+ <segment label="Rolling" tag="1"/>
+ </segments>
+ </segmentedCell>
+ </segmentedControl>
+ <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IVu-IX-YDR" userLabel="microphoneInputPopUpButton">
+ <rect key="frame" x="18" y="17" width="180" height="26"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="175" id="ioq-M7-ELj"/>
+ </constraints>
+ <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="gkh-2L-Rcb" id="sly-u2-g4x">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="Utg-Gp-vQm">
+ <items>
+ <menuItem title="Item 1" state="on" id="gkh-2L-Rcb"/>
+ <menuItem title="Item 2" id="2rH-JK-a4y"/>
+ <menuItem title="Item 3" id="dw1-Dc-qxo"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ </popUpButton>
+ <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3xi-d5-sVw" userLabel="microphoneInputChannelPopUpButton">
+ <rect key="frame" x="204" y="17" width="79" height="26"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="74" id="Kp2-s0-j9I"/>
+ </constraints>
+ <popUpButtonCell key="cell" type="push" title="1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="NCM-Lf-fXx" id="6eJ-Sd-amW">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="49c-2g-wMD">
+ <items>
+ <menuItem title="1" state="on" id="NCM-Lf-fXx"/>
+ <menuItem title="Item 2" id="OI0-T8-cpO"/>
+ <menuItem title="Item 3" id="AeX-Wz-vdf"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ </popUpButton>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="lqr-DS-FFh">
+ <rect key="frame" x="18" y="46" width="35" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Input" id="rIj-Yx-v99">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="vYb-ju-IqC">
+ <rect key="frame" x="203" y="46" width="54" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Channel" id="9KG-Wr-jCD">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="IVu-IX-YDR" secondAttribute="bottom" constant="20" id="AIm-kA-FKJ"/>
+ <constraint firstItem="3xi-d5-sVw" firstAttribute="top" secondItem="vYb-ju-IqC" secondAttribute="bottom" constant="5" id="J6P-eu-GlB"/>
+ <constraint firstAttribute="bottom" secondItem="3xi-d5-sVw" secondAttribute="bottom" constant="20" id="K1Q-VW-2Yi"/>
+ <constraint firstItem="IVu-IX-YDR" firstAttribute="top" secondItem="lqr-DS-FFh" secondAttribute="bottom" constant="5" id="KQk-cx-NEh"/>
+ <constraint firstItem="vYb-ju-IqC" firstAttribute="leading" secondItem="lqr-DS-FFh" secondAttribute="trailing" constant="154" id="KXq-hs-esD"/>
+ <constraint firstAttribute="bottom" secondItem="bZa-Zb-t7u" secondAttribute="bottom" constant="20" id="O1D-2X-1hG"/>
+ <constraint firstItem="bZa-Zb-t7u" firstAttribute="top" secondItem="CoM-zD-tS8" secondAttribute="bottom" constant="8" id="P3j-y3-DNM"/>
+ <constraint firstItem="IVu-IX-YDR" firstAttribute="leading" secondItem="9NH-Rm-uCu" secondAttribute="leading" constant="20" id="bIV-pc-Kvu"/>
+ <constraint firstItem="3xi-d5-sVw" firstAttribute="leading" secondItem="IVu-IX-YDR" secondAttribute="trailing" constant="11" id="uLe-jO-Sag"/>
+ <constraint firstItem="lqr-DS-FFh" firstAttribute="leading" secondItem="9NH-Rm-uCu" secondAttribute="leading" constant="20" id="uQS-RP-OVW"/>
+ <constraint firstAttribute="trailing" secondItem="bZa-Zb-t7u" secondAttribute="trailing" constant="20" id="z0Q-Gj-AN7"/>
+ <constraint firstAttribute="trailing" secondItem="CoM-zD-tS8" secondAttribute="trailing" constant="20" id="zKM-M3-25m"/>
+ </constraints>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="trailing" secondItem="9NH-Rm-uCu" secondAttribute="trailing" id="1hp-iA-K2z"/>
+ <constraint firstAttribute="bottom" secondItem="9NH-Rm-uCu" secondAttribute="bottom" id="JCe-fG-hr7"/>
+ <constraint firstItem="9NH-Rm-uCu" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="RCm-lm-fb8"/>
+ <constraint firstItem="9NH-Rm-uCu" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="WTZ-cG-mlb"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="369" y="433"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374DAD1C54503E000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374DAC1C54503E000B19D0 /* AppDelegate.m */; };
+ 66374DB01C54503E000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374DAF1C54503E000B19D0 /* main.m */; };
+ 66374DB21C54503E000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374DB11C54503E000B19D0 /* Assets.xcassets */; };
+ 66374DB51C54503E000B19D0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66374DB31C54503E000B19D0 /* MainMenu.xib */; };
+ 66374DBE1C545123000B19D0 /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374DBD1C545123000B19D0 /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DF11C54531E000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DEC1C54531E000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DF31C54531E000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DEC1C54531E000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374DA81C54503E000B19D0 /* PassThrough.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PassThrough.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374DAB1C54503E000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374DAC1C54503E000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374DAF1C54503E000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374DB11C54503E000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374DB41C54503E000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 66374DB61C54503E000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374DBD1C545123000B19D0 /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+ 66374DEC1C54531E000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374DA51C54503E000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374DBE1C545123000B19D0 /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374D9F1C54503E000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374DEC1C54531E000B19D0 /* EZAudio.xcodeproj */,
+ 66374DAA1C54503E000B19D0 /* PassThrough */,
+ 66374DBC1C545069000B19D0 /* Frameworks */,
+ 66374DA91C54503E000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374DA91C54503E000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DA81C54503E000B19D0 /* PassThrough.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374DAA1C54503E000B19D0 /* PassThrough */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DAB1C54503E000B19D0 /* AppDelegate.h */,
+ 66374DAC1C54503E000B19D0 /* AppDelegate.m */,
+ 66374DB11C54503E000B19D0 /* Assets.xcassets */,
+ 66374DB31C54503E000B19D0 /* MainMenu.xib */,
+ 66374DB61C54503E000B19D0 /* Info.plist */,
+ 66374DAE1C54503E000B19D0 /* Supporting Files */,
+ );
+ path = PassThrough;
+ sourceTree = "<group>";
+ };
+ 66374DAE1C54503E000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DAF1C54503E000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374DBC1C545069000B19D0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DBD1C545123000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DED1C54531E000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DF21C54531E000B19D0 /* EZAudioiOS.framework */,
+ 66374DF41C54531E000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374DA71C54503E000B19D0 /* PassThrough */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374DB91C54503E000B19D0 /* Build configuration list for PBXNativeTarget "PassThrough" */;
+ buildPhases = (
+ 66374DA41C54503E000B19D0 /* Sources */,
+ 66374DA51C54503E000B19D0 /* Frameworks */,
+ 66374DA61C54503E000B19D0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = PassThrough;
+ productName = PassThrough;
+ productReference = 66374DA81C54503E000B19D0 /* PassThrough.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374DA01C54503E000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374DA71C54503E000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 66374DA31C54503E000B19D0 /* Build configuration list for PBXProject "PassThrough" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 66374D9F1C54503E000B19D0;
+ productRefGroup = 66374DA91C54503E000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DED1C54531E000B19D0 /* Products */;
+ ProjectRef = 66374DEC1C54531E000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374DA71C54503E000B19D0 /* PassThrough */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DF21C54531E000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DF11C54531E000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DF41C54531E000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DF31C54531E000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374DA61C54503E000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374DB21C54503E000B19D0 /* Assets.xcassets in Resources */,
+ 66374DB51C54503E000B19D0 /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374DA41C54503E000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374DB01C54503E000B19D0 /* main.m in Sources */,
+ 66374DAD1C54503E000B19D0 /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 66374DB31C54503E000B19D0 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374DB41C54503E000B19D0 /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374DB71C54503E000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 66374DB81C54503E000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 66374DBA1C54503E000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = PassThrough/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PassThrough;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374DBB1C54503E000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = PassThrough/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PassThrough;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374DA31C54503E000B19D0 /* Build configuration list for PBXProject "PassThrough" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374DB71C54503E000B19D0 /* Debug */,
+ 66374DB81C54503E000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374DB91C54503E000B19D0 /* Build configuration list for PBXNativeTarget "PassThrough" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374DBA1C54503E000B19D0 /* Debug */,
+ 66374DBB1C54503E000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374DA01C54503E000B19D0 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZMicrophoneDelegate, NSApplicationDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (weak) IBOutlet NSWindow *window;
+
+//
+// The OpenGL based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the microphone state
+//
+@property (nonatomic, weak) IBOutlet NSButton *microphoneSwitch;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+-(IBAction)changePlotType:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send
+// its delegate (aka this view controller) the audio data in various ways
+// (check out the EZMicrophoneDelegate documentation for more details)
+//
+-(IBAction)toggleMicrophone:(id)sender;
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification
+{
+ //
+ // Customizing the audio plot's look
+ //
+
+ //
+ // Background color
+ //
+ self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.569 green: 0.82 blue: 0.478 alpha: 1];
+
+ //
+ // Waveform color
+ //
+ self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+
+ //
+ // Plot type
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Start the microphone
+ //
+ [EZMicrophone sharedMicrophone].delegate = self;
+ [[EZMicrophone sharedMicrophone] startFetchingAudio];
+
+ //
+ // Print out the input device being used
+ //
+ NSLog(@"Using input device: %@", [[EZMicrophone sharedMicrophone] device]);
+
+ //
+ // Use the microphone as the EZOutputDataSource
+ //
+ [[EZMicrophone sharedMicrophone] setOutput:[EZOutput sharedOutput]];
+
+ /**
+ Start the output
+ */
+ [[EZOutput sharedOutput] startPlayback];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegment];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ switch([sender state])
+ {
+ case NSOffState:
+ [[EZMicrophone sharedMicrophone] stopFetchingAudio];
+ break;
+ case NSOnState:
+ [[EZMicrophone sharedMicrophone] startFetchingAudio];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+//
+// Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input example)
+//
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+//
+// Give the classic mirrored, rolling waveform look
+//
+- (void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
+{
+ NSString *title = isPlaying ? @"Microphone On" : @"Microphone Off";
+ [self setTitle:title forButton:self.microphoneSwitch];
+}
+
+//------------------------------------------------------------------------------
+
+-(void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+#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
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ <capability name="box content view" minToolsVersion="7.0"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlot" destination="YXQ-h7-qe9" id="uyW-Yl-Snb"/>
+ <outlet property="microphoneSwitch" destination="urH-bi-gVf" id="zQp-7R-ueL"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="PassThrough" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="PassThrough" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About PassThrough" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide PassThrough" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit PassThrough" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="PassThrough Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="PassThrough" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="YXQ-h7-qe9" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <subviews>
+ <box autoresizesSubviews="NO" title="Box" boxType="custom" borderType="none" translatesAutoresizingMaskIntoConstraints="NO" id="tzL-9q-zMf">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="57"/>
+ <view key="contentView" id="xIl-8L-n84">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="57"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="urH-bi-gVf">
+ <rect key="frame" x="16" y="16" width="119" height="18"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="14" id="5t4-q9-aLP"/>
+ <constraint firstAttribute="width" constant="115" id="cNh-77-7gG"/>
+ </constraints>
+ <buttonCell key="cell" type="check" title="Microphone On" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="5l1-UU-DO1">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="toggleMicrophone:" target="Voe-Tx-rLC" id="NYj-Vv-n2G"/>
+ </connections>
+ </button>
+ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5gK-OS-BX2">
+ <rect key="frame" x="335" y="16" width="129" height="24"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="125" id="DWF-cX-8CA"/>
+ <constraint firstAttribute="height" constant="21" id="rY3-GE-XBd"/>
+ </constraints>
+ <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="5A1-D8-syC">
+ <font key="font" metaFont="system"/>
+ <segments>
+ <segment label="Buffer" selected="YES"/>
+ <segment label="Rolling" tag="1"/>
+ </segments>
+ </segmentedCell>
+ <connections>
+ <action selector="changePlotType:" target="Voe-Tx-rLC" id="nrs-cy-GYo"/>
+ </connections>
+ </segmentedControl>
+ </subviews>
+ </view>
+ <constraints>
+ <constraint firstAttribute="height" constant="57" id="NUx-pu-zY4"/>
+ <constraint firstItem="5gK-OS-BX2" firstAttribute="centerY" secondItem="tzL-9q-zMf" secondAttribute="centerY" id="cpu-nQ-w5r"/>
+ <constraint firstItem="urH-bi-gVf" firstAttribute="leading" secondItem="tzL-9q-zMf" secondAttribute="leading" constant="18" id="drL-NV-UBP"/>
+ <constraint firstItem="5gK-OS-BX2" firstAttribute="bottom" secondItem="urH-bi-gVf" secondAttribute="bottom" id="u0H-Zz-nHz"/>
+ <constraint firstAttribute="trailing" secondItem="5gK-OS-BX2" secondAttribute="trailing" constant="18" id="z9o-ED-Maa"/>
+ </constraints>
+ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+ <color key="fillColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="calibratedRGB"/>
+ </box>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="tzL-9q-zMf" secondAttribute="bottom" id="RVn-h0-2ZX"/>
+ <constraint firstAttribute="trailing" secondItem="tzL-9q-zMf" secondAttribute="trailing" id="TiI-nC-9tp"/>
+ <constraint firstItem="tzL-9q-zMf" firstAttribute="leading" secondItem="YXQ-h7-qe9" secondAttribute="leading" id="kEG-Ia-ILr"/>
+ </constraints>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="bottom" secondItem="YXQ-h7-qe9" secondAttribute="bottom" id="VMa-u3-61B"/>
+ <constraint firstItem="YXQ-h7-qe9" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="cVL-ft-W32"/>
+ <constraint firstAttribute="trailing" secondItem="YXQ-h7-qe9" secondAttribute="trailing" id="qQt-SC-VHr"/>
+ <constraint firstItem="YXQ-h7-qe9" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="zDc-dO-FHT"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="293" y="444"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// PassThrough
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 662B6CBA1C542DF500353D48 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 662B6CB91C542DF500353D48 /* AppDelegate.m */; };
+ 662B6CBD1C542DF500353D48 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 662B6CBC1C542DF500353D48 /* main.m */; };
+ 662B6CBF1C542DF500353D48 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 662B6CBE1C542DF500353D48 /* Assets.xcassets */; };
+ 662B6CC21C542DF500353D48 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 662B6CC01C542DF500353D48 /* MainMenu.xib */; };
+ 66374D521C542F5E000B19D0 /* simple-drum-beat.wav in Resources */ = {isa = PBXBuildFile; fileRef = 66374D511C542F5E000B19D0 /* simple-drum-beat.wav */; };
+ 66374D581C543DF3000B19D0 /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374D571C543DF3000B19D0 /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DD61C545314000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DD11C545314000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DD81C545314000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DD11C545314000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 662B6CB51C542DF500353D48 /* PlayFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PlayFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 662B6CB81C542DF500353D48 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 662B6CB91C542DF500353D48 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 662B6CBC1C542DF500353D48 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 662B6CBE1C542DF500353D48 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 662B6CC11C542DF500353D48 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 662B6CC31C542DF500353D48 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374D511C542F5E000B19D0 /* simple-drum-beat.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "simple-drum-beat.wav"; path = "../../simple-drum-beat.wav"; sourceTree = SOURCE_ROOT; };
+ 66374D571C543DF3000B19D0 /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+ 66374DD11C545314000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 662B6CB21C542DF500353D48 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D581C543DF3000B19D0 /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 662B6CAC1C542DF500353D48 = {
+ isa = PBXGroup;
+ children = (
+ 66374DD11C545314000B19D0 /* EZAudio.xcodeproj */,
+ 662B6CB71C542DF500353D48 /* PlayFile */,
+ 66374D4E1C542E6D000B19D0 /* Frameworks */,
+ 662B6CB61C542DF500353D48 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 662B6CB61C542DF500353D48 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 662B6CB51C542DF500353D48 /* PlayFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 662B6CB71C542DF500353D48 /* PlayFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D511C542F5E000B19D0 /* simple-drum-beat.wav */,
+ 662B6CB81C542DF500353D48 /* AppDelegate.h */,
+ 662B6CB91C542DF500353D48 /* AppDelegate.m */,
+ 662B6CBE1C542DF500353D48 /* Assets.xcassets */,
+ 662B6CC01C542DF500353D48 /* MainMenu.xib */,
+ 662B6CC31C542DF500353D48 /* Info.plist */,
+ 662B6CBB1C542DF500353D48 /* Supporting Files */,
+ );
+ path = PlayFile;
+ sourceTree = "<group>";
+ };
+ 662B6CBB1C542DF500353D48 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 662B6CBC1C542DF500353D48 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374D4E1C542E6D000B19D0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D571C543DF3000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DD21C545314000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DD71C545314000B19D0 /* EZAudioiOS.framework */,
+ 66374DD91C545314000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 662B6CB41C542DF500353D48 /* PlayFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 662B6CC61C542DF500353D48 /* Build configuration list for PBXNativeTarget "PlayFile" */;
+ buildPhases = (
+ 662B6CB11C542DF500353D48 /* Sources */,
+ 662B6CB21C542DF500353D48 /* Frameworks */,
+ 662B6CB31C542DF500353D48 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = PlayFile;
+ productName = PlayFile;
+ productReference = 662B6CB51C542DF500353D48 /* PlayFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 662B6CAD1C542DF500353D48 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 662B6CB41C542DF500353D48 = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 662B6CB01C542DF500353D48 /* Build configuration list for PBXProject "PlayFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 662B6CAC1C542DF500353D48;
+ productRefGroup = 662B6CB61C542DF500353D48 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DD21C545314000B19D0 /* Products */;
+ ProjectRef = 66374DD11C545314000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 662B6CB41C542DF500353D48 /* PlayFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DD71C545314000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DD61C545314000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DD91C545314000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DD81C545314000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 662B6CB31C542DF500353D48 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 662B6CBF1C542DF500353D48 /* Assets.xcassets in Resources */,
+ 662B6CC21C542DF500353D48 /* MainMenu.xib in Resources */,
+ 66374D521C542F5E000B19D0 /* simple-drum-beat.wav in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 662B6CB11C542DF500353D48 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 662B6CBD1C542DF500353D48 /* main.m in Sources */,
+ 662B6CBA1C542DF500353D48 /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 662B6CC01C542DF500353D48 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 662B6CC11C542DF500353D48 /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 662B6CC41C542DF500353D48 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 662B6CC51C542DF500353D48 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 662B6CC71C542DF500353D48 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = PlayFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PlayFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 662B6CC81C542DF500353D48 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = PlayFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PlayFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 662B6CB01C542DF500353D48 /* Build configuration list for PBXProject "PlayFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 662B6CC41C542DF500353D48 /* Debug */,
+ 662B6CC51C542DF500353D48 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 662B6CC61C542DF500353D48 /* Build configuration list for PBXNativeTarget "PlayFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 662B6CC71C542DF500353D48 /* Debug */,
+ 662B6CC81C542DF500353D48 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 662B6CAD1C542DF500353D48 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// Here's the default audio file included with the example
+//
+#define kAudioFileDefault [[NSBundle mainBundle] pathForResource:@"simple-drum-beat" ofType:@"wav"]
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZAudioPlayerDelegate, NSApplicationDelegate, NSOpenSavePanelDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (weak) IBOutlet NSWindow *window;
+
+//
+// The EZAudioPlayer component used to play the audio file.
+//
+@property (nonatomic, strong) EZAudioPlayer *player;
+
+//
+// An OpenGL based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//
+// A label to display the current file path with the waveform shown
+//
+@property (nonatomic, weak) IBOutlet NSTextField *filePathLabel;
+
+//
+// A checkbox button to that allows you to specify if the audio player should loop.
+//
+@property (nonatomic, weak) IBOutlet NSButton *loopCheckboxButton;
+
+//
+// The play/pause button
+//
+@property (nonatomic,weak) IBOutlet NSButton *playButton;
+
+//
+// A segment control representing the plot type selection
+//
+@property (nonatomic,weak) IBOutlet NSSegmentedControl *plotSegmentControl;
+
+//
+// A label to display the audio file's current time.
+//
+@property (nonatomic, weak) IBOutlet NSTextField *positionLabel;
+
+//
+// A slider to indicate the current frame position in the audio file
+//
+@property (nonatomic, weak) IBOutlet NSSlider *positionSlider;
+
+//
+// A label to display the value of the rolling history length of the audio plot.
+//
+@property (nonatomic, weak) IBOutlet NSTextField *rollingHistoryLengthLabel;
+
+//
+// A slider to adjust the rolling history length of the audio plot.
+//
+@property (nonatomic, weak) IBOutlet NSSlider *rollingHistoryLengthSlider;
+
+//
+// A slider to adjust the volume.
+//
+@property (nonatomic, weak) IBOutlet NSSlider *volumeSlider;
+
+//
+// A label to display the volume of the audio plot.
+//
+@property (nonatomic, weak) IBOutlet NSTextField *volumeLabel;
+
+//
+// The microphone pop up button (contains the menu for choosing a microphone input)
+//
+@property (nonatomic, weak) IBOutlet NSPopUpButton *outputDevicePopUpButton;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the
+// current stream of audio data from the update function) or a rolling plot
+// (visualizes the audio data over time, this is the classic waveform look)
+//
+-(IBAction)changePlotType:(id)sender;
+
+//
+// Changes the length of the rolling history of the audio plot.
+//
+- (IBAction)changeRollingHistoryLength:(id)sender;
+
+//
+// Switches the loop state on the audio player regarding whether the current
+// playing audio file should loop back to the beginning when it finishes.
+//
+- (IBAction)changeShouldLoop:(id)sender;
+
+//
+// Changes the volume of the audio coming out of the EZOutput.
+//
+- (IBAction)changeVolume:(id)sender;
+
+//
+// Prompts the file manager and loads in a new audio file into the
+// EZAudioFile representation.
+//
+-(IBAction)openFile:(id)sender;
+
+//
+// Begins playback if a file is loaded. Pauses if the file is already playing.
+//
+-(IBAction)play:(id)sender;
+
+//
+// Seeks to a specific frame in the audio file.
+//
+-(IBAction)seekToFrame:(id)sender;
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification {
+ //
+ // Customizing the audio plot's look
+ //
+ // Background color
+ self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.816 green: 0.349 blue: 0.255 alpha: 1];
+ // Waveform color
+ self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+ // Plot type
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ // Fill
+ self.audioPlot.shouldFill = YES;
+ // Mirror
+ self.audioPlot.shouldMirror = YES;
+
+ //
+ // Create EZOutput to play audio data
+ //
+ self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
+ self.player.shouldLoop = YES;
+
+ //
+ // Reload the menu for the output device selector popup button
+ //
+ [self reloadOutputDevicePopUpButtonMenu];
+
+ //
+ // Configure UI components
+ //
+ self.volumeSlider.floatValue = [self.player volume];
+ self.volumeLabel.floatValue = [self.player volume];
+ self.rollingHistoryLengthSlider.intValue = [self.audioPlot rollingHistoryLength];
+ self.rollingHistoryLengthLabel.intValue = [self.audioPlot rollingHistoryLength];
+ self.loopCheckboxButton.state = [self.player shouldLoop];
+
+ //
+ // Listen for state changes to the EZAudioPlayer
+ //
+ [self setupNotifications];
+
+ //
+ // Try opening the sample file
+ //
+ [self openFileWithFilePathURL:[NSURL fileURLWithPath:kAudioFileDefault]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+- (void)setupNotifications
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangeAudioFile:)
+ name:EZAudioPlayerDidChangeAudioFileNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangeOutputDevice:)
+ name:EZAudioPlayerDidChangeOutputDeviceNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangePlayState:)
+ name:EZAudioPlayerDidChangePlayStateNotification
+ object:self.player];
+
+ // This notification will only trigger if the player's shouldLoop property is set to NO
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidReachEndOfFile:)
+ name:EZAudioPlayerDidReachEndOfFileNotification
+ object:self.player];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangeAudioFile:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player changed audio file: %@", [player audioFile]);
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangeOutputDevice:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player changed output device: %@", [player device]);
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangePlayState:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player change play state, isPlaying: %i", [player isPlaying]);
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidReachEndOfFile:(NSNotification *)notification
+{
+ NSLog(@"Player did reach end of file!");
+ [self.playButton setState:NSOffState];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changedOutput:(NSMenuItem *)item
+{
+ EZAudioDevice *device = [item representedObject];
+ [self.player setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegment];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changeShouldLoop:(id)sender
+{
+ NSInteger state = [(NSButton *)sender state];
+ [self.player setShouldLoop:state];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changeVolume:(id)sender
+{
+ float value = [(NSSlider *)sender floatValue];
+ [self.player setVolume:value];
+ self.volumeLabel.floatValue = value;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changeRollingHistoryLength:(id)sender
+{
+ float value = [(NSSlider *)sender floatValue];
+ self.audioPlot.rollingHistoryLength = (int)value;
+ self.rollingHistoryLengthLabel.floatValue = value;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)openFile:(id)sender
+{
+ NSOpenPanel* openDlg = [NSOpenPanel openPanel];
+ openDlg.canChooseFiles = YES;
+ openDlg.canChooseDirectories = NO;
+ openDlg.delegate = self;
+ if ([openDlg runModal] == NSModalResponseOK)
+ {
+ NSArray *selectedFiles = [openDlg URLs];
+ [self openFileWithFilePathURL:selectedFiles.firstObject];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+-(void)play:(id)sender
+{
+ if (![self.player isPlaying])
+ {
+ if (self.player.state == EZAudioPlayerStateEndOfFile)
+ {
+ [self.player seekToFrame:0];
+ }
+ if (self.audioPlot.plotType == EZPlotTypeBuffer
+ && self.audioPlot.shouldFill == YES)
+ {
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ }
+ [self.player play];
+ }
+ else
+ {
+ [self.player pause];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+-(void)seekToFrame:(id)sender
+{
+ double value = [(NSSlider*)sender doubleValue];
+ [self.player seekToFrame:(SInt64)value];
+ self.positionLabel.stringValue = self.player.formattedCurrentTime;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+//
+// Give the visualization of the current buffer (this is almost exactly
+// the openFrameworks audio input example)
+//
+-(void)drawBufferPlot
+{
+ // Change the plot type to the buffer plot
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ // Don't fill
+ self.audioPlot.shouldFill = NO;
+ // Don't mirror over the x-axis
+ self.audioPlot.shouldMirror = NO;
+}
+
+//------------------------------------------------------------------------------
+
+//
+// Give the classic mirrored, rolling waveform look
+//
+-(void)drawRollingPlot
+{
+ // Change the plot type to the rolling plot
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ // Fill the waveform
+ self.audioPlot.shouldFill = YES;
+ // Mirror over the x-axis
+ self.audioPlot.shouldMirror = YES;
+}
+
+//------------------------------------------------------------------------------
+
+-(void)openFileWithFilePathURL:(NSURL*)filePathURL
+{
+ //
+ // Stop playback
+ //
+ [self.player pause];
+
+ //
+ // Clear the audio plot
+ //
+ [self.audioPlot clear];
+
+ //
+ // Change back to a buffer plot, but mirror and fill the waveform
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+
+ //
+ // Load the audio file and customize the UI
+ //
+ self.player.audioFile = [EZAudioFile audioFileWithURL:filePathURL];
+ self.filePathLabel.stringValue = filePathURL.lastPathComponent;
+ self.positionSlider.minValue = 0.0f;
+ self.positionSlider.maxValue = (double)self.player.audioFile.totalFrames;
+ self.playButton.state = NSOffState;
+ self.plotSegmentControl.selectedSegment = self.audioPlot.plotType;
+
+ //
+ // Plot the whole waveform
+ //
+ __weak typeof (self) weakSelf = self;
+ [self.player.audioFile getWaveformDataWithNumberOfPoints:1024
+ completion:^(float **waveformData,
+ int length)
+ {
+ [weakSelf.audioPlot updateBuffer:waveformData[0]
+ withBufferSize:length];
+ }];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)reloadOutputDevicePopUpButtonMenu
+{
+ NSArray *outputDevices = [EZAudioDevice outputDevices];
+ NSMenu *menu = [[NSMenu alloc] init];
+ NSMenuItem *defaultOutputDeviceItem;
+ for (EZAudioDevice *device in outputDevices)
+ {
+ NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:device.name
+ action:@selector(changedOutput:)
+ keyEquivalent:@""];
+ item.representedObject = device;
+ item.target = self;
+ [menu addItem:item];
+
+ // If this device is the same one the microphone is using then
+ // we will use this menu item as the currently selected item
+ // in the microphone input popup button's list of items. For instance,
+ // if you are connected to an external display by default the external
+ // display's microphone might be used instead of the mac's built in
+ // mic.
+ if ([device isEqual:[self.player device]])
+ {
+ defaultOutputDeviceItem = item;
+ }
+ }
+ self.outputDevicePopUpButton.menu = menu;
+
+ //
+ // Set the selected device to the current selection on the
+ // microphone input popup button
+ //
+ [self.outputDevicePopUpButton selectItem:defaultOutputDeviceItem];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayerDelegate
+//------------------------------------------------------------------------------
+
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!weakSelf.positionSlider.highlighted)
+ {
+ weakSelf.positionSlider.floatValue = (float)framePosition;
+ weakSelf.positionLabel.stringValue = audioPlayer.formattedCurrentTime;
+ }
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - NSOpenSavePanelDelegate
+//------------------------------------------------------------------------------
+
+// Here's an example how to filter the open panel to only show the supported
+// file types by the EZAudioFile (which are just the audio file types supported
+// by Core Audio).
+- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
+{
+ NSString *ext = [filename pathExtension];
+ NSArray *fileTypes = [EZAudioFile supportedAudioFileTypes];
+ BOOL isDirectory = [ext isEqualToString:@""];
+ return [fileTypes containsObject:ext] || isDirectory;
+}
+
+//------------------------------------------------------------------------------
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ <capability name="box content view" minToolsVersion="7.0"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlot" destination="eMs-Ij-ZGv" id="ejS-2o-EDc"/>
+ <outlet property="filePathLabel" destination="UgZ-um-AfU" id="4wJ-wo-Z5x"/>
+ <outlet property="loopCheckboxButton" destination="8kN-iJ-UII" id="pAH-p9-1zn"/>
+ <outlet property="outputDevicePopUpButton" destination="9PF-Dm-kOq" id="RaV-d5-Jd1"/>
+ <outlet property="playButton" destination="kSY-Tf-CNW" id="sNb-xL-056"/>
+ <outlet property="plotSegmentControl" destination="qMt-Gg-gFD" id="Nyt-kZ-63O"/>
+ <outlet property="positionLabel" destination="t00-Ok-dIq" id="WcJ-00-okC"/>
+ <outlet property="positionSlider" destination="3r1-Fd-5Ml" id="5MQ-OA-DDL"/>
+ <outlet property="rollingHistoryLengthLabel" destination="V8A-XE-sbB" id="oVq-34-hoN"/>
+ <outlet property="rollingHistoryLengthSlider" destination="rsX-T2-N6M" id="uY1-Jv-j3z"/>
+ <outlet property="volumeLabel" destination="5Tt-wP-Pfb" id="Q9p-bp-ZUf"/>
+ <outlet property="volumeSlider" destination="HtU-mk-RyR" id="AHz-N9-9Xq"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="PlayFile" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="PlayFile" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About PlayFile" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide PlayFile" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit PlayFile" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="PlayFile Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="PlayFile" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="366"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="366"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="eMs-Ij-ZGv" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="366"/>
+ <subviews>
+ <box autoresizesSubviews="NO" title="Box" boxType="custom" borderType="none" translatesAutoresizingMaskIntoConstraints="NO" id="bz2-AD-NJs">
+ <rect key="frame" x="0.0" y="124" width="480" height="242"/>
+ <view key="contentView" id="PEG-5L-rPR">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="242"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="LaU-At-yMu">
+ <rect key="frame" x="12" y="172" width="123" height="32"/>
+ <buttonCell key="cell" type="push" title="Choose File..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="Jer-th-dGG">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="openFile:" target="Voe-Tx-rLC" id="xIH-h6-w3s"/>
+ </connections>
+ </button>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UgZ-um-AfU">
+ <rect key="frame" x="138" y="184" width="35" height="16"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" alignment="left" title="Label" id="arB-PC-pFO">
+ <font key="font" metaFont="cellTitle"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kSY-Tf-CNW">
+ <rect key="frame" x="12" y="139" width="123" height="32"/>
+ <buttonCell key="cell" type="push" title="Play" alternateTitle="Pause" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="kIb-wu-S3b">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="play:" target="Voe-Tx-rLC" id="nPF-NA-VtZ"/>
+ </connections>
+ </button>
+ <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="qMt-Gg-gFD">
+ <rect key="frame" x="335" y="144" width="129" height="24"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="125" id="jxZ-1y-QRn"/>
+ </constraints>
+ <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="vla-hq-5je">
+ <font key="font" metaFont="system"/>
+ <segments>
+ <segment label="Buffer" selected="YES"/>
+ <segment label="Rolling" tag="1"/>
+ </segments>
+ </segmentedCell>
+ <connections>
+ <action selector="changePlotType:" target="Voe-Tx-rLC" id="k7k-eL-DZI"/>
+ </connections>
+ </segmentedControl>
+ <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3r1-Fd-5Ml">
+ <rect key="frame" x="116" y="94" width="270" height="20"/>
+ <sliderCell key="cell" continuous="YES" alignment="left" maxValue="100" doubleValue="9.3380614657210401" tickMarkPosition="above" sliderType="linear" id="mcl-Cd-ys3"/>
+ <connections>
+ <action selector="seekToFrame:" target="Voe-Tx-rLC" id="IMK-n3-pun"/>
+ </connections>
+ </slider>
+ <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="rsX-T2-N6M">
+ <rect key="frame" x="116" y="69" width="270" height="20"/>
+ <sliderCell key="cell" continuous="YES" alignment="left" minValue="128" maxValue="1024" doubleValue="128" tickMarkPosition="above" sliderType="linear" id="MG3-Rb-b8L"/>
+ <connections>
+ <action selector="changeRollingHistoryLength:" target="Voe-Tx-rLC" id="ypX-pJ-iKV"/>
+ </connections>
+ </slider>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2sl-Yt-WPy">
+ <rect key="frame" x="16" y="121" width="53" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Volume:" id="dqF-tn-aA2">
+ <font key="font" metaFont="systemBold" size="12"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nuL-gR-u3g">
+ <rect key="frame" x="16" y="96" width="58" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Position:" id="XnY-cC-mcp">
+ <font key="font" metaFont="systemBold" size="12"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="939-3F-zvH">
+ <rect key="frame" x="16" y="71" width="95" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="Rolling Length:" id="gmI-bk-lpT">
+ <font key="font" metaFont="systemBold" size="12"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="5Tt-wP-Pfb">
+ <rect key="frame" x="390" y="121" width="72" height="16"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="68" id="6Lp-QI-emC"/>
+ </constraints>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="0.00" id="6zV-ap-tgO">
+ <numberFormatter key="formatter" formatterBehavior="custom10_4" minimumIntegerDigits="1" maximumIntegerDigits="1" minimumFractionDigits="2" maximumFractionDigits="2" id="Y8g-4u-ifJ"/>
+ <font key="font" metaFont="cellTitle"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <slider verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="HtU-mk-RyR">
+ <rect key="frame" x="116" y="119" width="270" height="20"/>
+ <sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="1" doubleValue="0.5" tickMarkPosition="above" sliderType="linear" id="76i-lI-sD6"/>
+ <connections>
+ <action selector="changeVolume:" target="Voe-Tx-rLC" id="y8e-xa-R34"/>
+ </connections>
+ </slider>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="V8A-XE-sbB">
+ <rect key="frame" x="390" y="71" width="72" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="0" id="Olu-tS-gSN">
+ <numberFormatter key="formatter" formatterBehavior="custom10_4" minimumIntegerDigits="0" maximumIntegerDigits="42" id="0En-xE-gzL"/>
+ <font key="font" metaFont="cellTitle"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="9PF-Dm-kOq" userLabel="microphoneInputPopUpButton">
+ <rect key="frame" x="16" y="13" width="180" height="26"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="175" id="imp-QE-9Zn"/>
+ </constraints>
+ <popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="Tsn-fk-cet" id="iFY-kO-v4k">
+ <behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="menu"/>
+ <menu key="menu" id="G1P-on-Adu">
+ <items>
+ <menuItem title="Item 1" state="on" id="Tsn-fk-cet"/>
+ <menuItem title="Item 2" id="Nov-Ax-y8A"/>
+ <menuItem title="Item 3" id="HTc-Vx-ZI1"/>
+ </items>
+ </menu>
+ </popUpButtonCell>
+ </popUpButton>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="uw2-jd-O8R">
+ <rect key="frame" x="16" y="46" width="51" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Output:" id="n4K-JF-owA">
+ <font key="font" metaFont="systemBold" size="12"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="t00-Ok-dIq">
+ <rect key="frame" x="390" y="96" width="72" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" title="0" id="COg-OX-2nL">
+ <numberFormatter key="formatter" formatterBehavior="custom10_4" minimumIntegerDigits="0" maximumIntegerDigits="42" id="AIP-gm-qiv"/>
+ <font key="font" metaFont="cellTitle"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="8kN-iJ-UII">
+ <rect key="frame" x="442" y="14" width="22" height="18"/>
+ <buttonCell key="cell" type="check" bezelStyle="regularSquare" imagePosition="right" alignment="right" state="on" inset="2" id="moX-Jd-cv5">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="changeShouldLoop:" target="Voe-Tx-rLC" id="dxs-Sb-AY7"/>
+ </connections>
+ </button>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Ba9-Kg-Xpb">
+ <rect key="frame" x="408" y="16" width="34" height="16"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Loop" id="pcq-Cs-hg9">
+ <font key="font" metaFont="systemBold" size="12"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ </view>
+ <constraints>
+ <constraint firstItem="HtU-mk-RyR" firstAttribute="baseline" secondItem="2sl-Yt-WPy" secondAttribute="baseline" id="1dR-DF-J1a"/>
+ <constraint firstItem="qMt-Gg-gFD" firstAttribute="trailing" secondItem="8kN-iJ-UII" secondAttribute="trailing" id="33U-sK-F1e"/>
+ <constraint firstItem="t00-Ok-dIq" firstAttribute="leading" secondItem="3r1-Fd-5Ml" secondAttribute="trailing" constant="8" symbolic="YES" id="36z-ka-1Od"/>
+ <constraint firstItem="5Tt-wP-Pfb" firstAttribute="leading" secondItem="t00-Ok-dIq" secondAttribute="leading" id="6WC-Dc-5cj"/>
+ <constraint firstItem="9PF-Dm-kOq" firstAttribute="top" secondItem="uw2-jd-O8R" secondAttribute="bottom" constant="9" id="8Er-YP-pXI"/>
+ <constraint firstItem="t00-Ok-dIq" firstAttribute="leading" secondItem="V8A-XE-sbB" secondAttribute="leading" id="8ex-S1-eYT"/>
+ <constraint firstItem="LaU-At-yMu" firstAttribute="leading" secondItem="kSY-Tf-CNW" secondAttribute="leading" id="9Ww-oi-M0T"/>
+ <constraint firstItem="kSY-Tf-CNW" firstAttribute="trailing" secondItem="LaU-At-yMu" secondAttribute="trailing" id="A0b-25-Bkb"/>
+ <constraint firstAttribute="trailing" secondItem="qMt-Gg-gFD" secondAttribute="trailing" constant="18" id="Aue-eI-UTU"/>
+ <constraint firstAttribute="height" constant="242" id="FKY-vF-rJo"/>
+ <constraint firstItem="rsX-T2-N6M" firstAttribute="baseline" secondItem="939-3F-zvH" secondAttribute="baseline" id="FVB-KX-s22"/>
+ <constraint firstItem="nuL-gR-u3g" firstAttribute="top" secondItem="2sl-Yt-WPy" secondAttribute="bottom" constant="9" id="I4b-eY-Sve"/>
+ <constraint firstItem="t00-Ok-dIq" firstAttribute="trailing" secondItem="5Tt-wP-Pfb" secondAttribute="trailing" id="KZU-Af-ucr"/>
+ <constraint firstItem="uw2-jd-O8R" firstAttribute="leading" secondItem="9PF-Dm-kOq" secondAttribute="leading" id="MOh-bh-Gjp"/>
+ <constraint firstItem="939-3F-zvH" firstAttribute="top" secondItem="nuL-gR-u3g" secondAttribute="bottom" constant="9" id="NiF-F5-mj2"/>
+ <constraint firstItem="3r1-Fd-5Ml" firstAttribute="leading" secondItem="rsX-T2-N6M" secondAttribute="leading" id="NvO-uc-uPA"/>
+ <constraint firstItem="2sl-Yt-WPy" firstAttribute="top" secondItem="kSY-Tf-CNW" secondAttribute="bottom" constant="9" id="OyK-df-Ell"/>
+ <constraint firstItem="2sl-Yt-WPy" firstAttribute="leading" secondItem="kSY-Tf-CNW" secondAttribute="leading" id="RL2-Ha-hvm"/>
+ <constraint firstItem="UgZ-um-AfU" firstAttribute="leading" secondItem="LaU-At-yMu" secondAttribute="trailing" constant="11" id="ShG-nR-iBQ"/>
+ <constraint firstItem="5Tt-wP-Pfb" firstAttribute="leading" secondItem="HtU-mk-RyR" secondAttribute="trailing" constant="8" symbolic="YES" id="St8-b6-rg9"/>
+ <constraint firstAttribute="trailing" secondItem="5Tt-wP-Pfb" secondAttribute="trailing" constant="20" id="UI1-on-ciV"/>
+ <constraint firstItem="V8A-XE-sbB" firstAttribute="trailing" secondItem="t00-Ok-dIq" secondAttribute="trailing" id="Uod-6y-jMl"/>
+ <constraint firstItem="HtU-mk-RyR" firstAttribute="baseline" secondItem="5Tt-wP-Pfb" secondAttribute="baseline" id="V7w-eF-irm"/>
+ <constraint firstItem="rsX-T2-N6M" firstAttribute="baseline" secondItem="V8A-XE-sbB" secondAttribute="baseline" id="Z8g-gG-vff"/>
+ <constraint firstItem="3r1-Fd-5Ml" firstAttribute="baseline" secondItem="nuL-gR-u3g" secondAttribute="baseline" id="ZDZ-4H-L6I"/>
+ <constraint firstItem="uw2-jd-O8R" firstAttribute="top" secondItem="939-3F-zvH" secondAttribute="bottom" constant="9" id="aWR-BG-36y"/>
+ <constraint firstAttribute="bottom" secondItem="9PF-Dm-kOq" secondAttribute="bottom" constant="16" id="cIv-BX-j92"/>
+ <constraint firstItem="V8A-XE-sbB" firstAttribute="leading" secondItem="rsX-T2-N6M" secondAttribute="trailing" constant="8" symbolic="YES" id="edb-wa-cGs"/>
+ <constraint firstItem="3r1-Fd-5Ml" firstAttribute="leading" secondItem="HtU-mk-RyR" secondAttribute="leading" id="fPR-Iu-Ujq"/>
+ <constraint firstItem="qMt-Gg-gFD" firstAttribute="top" secondItem="kSY-Tf-CNW" secondAttribute="top" id="g3a-R9-IRO"/>
+ <constraint firstItem="8kN-iJ-UII" firstAttribute="leading" secondItem="Ba9-Kg-Xpb" secondAttribute="trailing" constant="4" id="gsA-Ve-wP6"/>
+ <constraint firstItem="nuL-gR-u3g" firstAttribute="leading" secondItem="939-3F-zvH" secondAttribute="leading" id="kOh-i2-ePt"/>
+ <constraint firstItem="t00-Ok-dIq" firstAttribute="baseline" secondItem="3r1-Fd-5Ml" secondAttribute="baseline" id="mGQ-4Y-dfZ"/>
+ <constraint firstItem="LaU-At-yMu" firstAttribute="top" secondItem="UgZ-um-AfU" secondAttribute="top" id="nFI-Vr-bUf"/>
+ <constraint firstItem="rsX-T2-N6M" firstAttribute="leading" secondItem="939-3F-zvH" secondAttribute="trailing" constant="9" id="nr6-qs-Zww"/>
+ <constraint firstItem="kSY-Tf-CNW" firstAttribute="top" secondItem="LaU-At-yMu" secondAttribute="bottom" constant="12" symbolic="YES" id="oPf-cB-2E9"/>
+ <constraint firstItem="uw2-jd-O8R" firstAttribute="leading" secondItem="939-3F-zvH" secondAttribute="leading" id="q1Q-HM-jDH"/>
+ <constraint firstItem="LaU-At-yMu" firstAttribute="leading" secondItem="bz2-AD-NJs" secondAttribute="leading" constant="18" id="sCU-Gn-9h8"/>
+ <constraint firstItem="2sl-Yt-WPy" firstAttribute="leading" secondItem="nuL-gR-u3g" secondAttribute="leading" id="sVD-2u-Wvz"/>
+ <constraint firstAttribute="bottom" secondItem="Ba9-Kg-Xpb" secondAttribute="bottom" constant="16" id="woj-14-7FI"/>
+ <constraint firstItem="9PF-Dm-kOq" firstAttribute="bottom" secondItem="8kN-iJ-UII" secondAttribute="bottom" id="yNT-bh-dpB"/>
+ </constraints>
+ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+ <color key="fillColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="calibratedRGB"/>
+ </box>
+ </subviews>
+ <constraints>
+ <constraint firstAttribute="trailing" secondItem="bz2-AD-NJs" secondAttribute="trailing" id="1qB-Co-G0X"/>
+ <constraint firstItem="bz2-AD-NJs" firstAttribute="top" secondItem="eMs-Ij-ZGv" secondAttribute="top" id="1rc-KE-3dH"/>
+ <constraint firstItem="bz2-AD-NJs" firstAttribute="leading" secondItem="eMs-Ij-ZGv" secondAttribute="leading" id="hmN-LA-zqz"/>
+ </constraints>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstItem="eMs-Ij-ZGv" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="Ep6-70-HZp"/>
+ <constraint firstAttribute="bottom" secondItem="eMs-Ij-ZGv" secondAttribute="bottom" id="JXh-Cu-XTv"/>
+ <constraint firstItem="eMs-Ij-ZGv" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="LQV-SK-mp1"/>
+ <constraint firstAttribute="trailing" secondItem="eMs-Ij-ZGv" secondAttribute="trailing" id="Twz-mG-sjQ"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="382" y="280"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// PlayFile
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374D3F1C542E18000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D3E1C542E18000B19D0 /* AppDelegate.m */; };
+ 66374D421C542E18000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D411C542E18000B19D0 /* main.m */; };
+ 66374D441C542E18000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374D431C542E18000B19D0 /* Assets.xcassets */; };
+ 66374D471C542E18000B19D0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66374D451C542E18000B19D0 /* MainMenu.xib */; };
+ 66374D5A1C5440BC000B19D0 /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374D591C5440BC000B19D0 /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DDF1C545316000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DDA1C545316000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DE11C545316000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DDA1C545316000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374D3A1C542E18000B19D0 /* RecordFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RecordFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374D3D1C542E18000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374D3E1C542E18000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374D411C542E18000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374D431C542E18000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374D461C542E18000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 66374D481C542E18000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374D591C5440BC000B19D0 /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+ 66374DDA1C545316000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374D371C542E18000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D5A1C5440BC000B19D0 /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374D311C542E18000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374DDA1C545316000B19D0 /* EZAudio.xcodeproj */,
+ 66374D3C1C542E18000B19D0 /* RecordFile */,
+ 66374D4F1C542E71000B19D0 /* Frameworks */,
+ 66374D3B1C542E18000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374D3B1C542E18000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D3A1C542E18000B19D0 /* RecordFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374D3C1C542E18000B19D0 /* RecordFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D3D1C542E18000B19D0 /* AppDelegate.h */,
+ 66374D3E1C542E18000B19D0 /* AppDelegate.m */,
+ 66374D431C542E18000B19D0 /* Assets.xcassets */,
+ 66374D451C542E18000B19D0 /* MainMenu.xib */,
+ 66374D481C542E18000B19D0 /* Info.plist */,
+ 66374D401C542E18000B19D0 /* Supporting Files */,
+ );
+ path = RecordFile;
+ sourceTree = "<group>";
+ };
+ 66374D401C542E18000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D411C542E18000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374D4F1C542E71000B19D0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D591C5440BC000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DDB1C545316000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DE01C545316000B19D0 /* EZAudioiOS.framework */,
+ 66374DE21C545316000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374D391C542E18000B19D0 /* RecordFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374D4B1C542E18000B19D0 /* Build configuration list for PBXNativeTarget "RecordFile" */;
+ buildPhases = (
+ 66374D361C542E18000B19D0 /* Sources */,
+ 66374D371C542E18000B19D0 /* Frameworks */,
+ 66374D381C542E18000B19D0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = RecordFile;
+ productName = RecordFile;
+ productReference = 66374D3A1C542E18000B19D0 /* RecordFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374D321C542E18000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374D391C542E18000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 66374D351C542E18000B19D0 /* Build configuration list for PBXProject "RecordFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 66374D311C542E18000B19D0;
+ productRefGroup = 66374D3B1C542E18000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DDB1C545316000B19D0 /* Products */;
+ ProjectRef = 66374DDA1C545316000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374D391C542E18000B19D0 /* RecordFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DE01C545316000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DDF1C545316000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DE21C545316000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DE11C545316000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374D381C542E18000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D441C542E18000B19D0 /* Assets.xcassets in Resources */,
+ 66374D471C542E18000B19D0 /* MainMenu.xib in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374D361C542E18000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D421C542E18000B19D0 /* main.m in Sources */,
+ 66374D3F1C542E18000B19D0 /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 66374D451C542E18000B19D0 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374D461C542E18000B19D0 /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374D491C542E18000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 66374D4A1C542E18000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.11;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 66374D4C1C542E18000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = RecordFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.RecordFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374D4D1C542E18000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = RecordFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.RecordFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374D351C542E18000B19D0 /* Build configuration list for PBXProject "RecordFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D491C542E18000B19D0 /* Debug */,
+ 66374D4A1C542E18000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374D4B1C542E18000B19D0 /* Build configuration list for PBXNativeTarget "RecordFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D4C1C542E18000B19D0 /* Debug */,
+ 66374D4D1C542E18000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374D321C542E18000B19D0 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// By default this will record a file to /Users/YOUR_USERNAME/Documents/test.m4a
+//
+#define kAudioFilePath [NSString stringWithFormat:@"%@%@",NSHomeDirectory(),@"/Documents/test.m4a"]
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <EZAudioPlayerDelegate, EZMicrophoneDelegate, EZRecorderDelegate, NSApplicationDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+@property (weak) IBOutlet NSWindow *window;
+
+//
+// The label used to display the current time for recording/playback in the top
+// left
+//
+@property (nonatomic, weak) IBOutlet NSTextField *currentTimeLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// Use a OpenGL based plot to visualize the data coming in
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *recordingAudioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// A flag indicating whether we are recording or not
+//
+@property (nonatomic, assign) BOOL isRecording;
+
+//------------------------------------------------------------------------------
+
+//
+// The microphone component
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//------------------------------------------------------------------------------
+
+//
+// The switch used to toggle the microphone on/off
+//
+@property (nonatomic, weak) IBOutlet NSButton *microphoneSwitch;
+
+//------------------------------------------------------------------------------
+
+//
+// The audio player that will play the recorded file
+//
+@property (nonatomic, strong) EZAudioPlayer *player;
+
+//------------------------------------------------------------------------------
+
+//
+// The recorder component
+//
+@property (nonatomic, strong) EZRecorder *recorder;
+
+//------------------------------------------------------------------------------
+
+//
+// The second audio plot used on the top right to display the current playing audio
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *playingAudioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// The button the user taps to play the recorded audio file
+//
+@property (nonatomic, weak) IBOutlet NSButton *playButton;
+
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the audio player play state
+//
+@property (nonatomic, weak) IBOutlet NSTextField *playingStateLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// The switch used to toggle the recording on/off
+//
+@property (nonatomic, weak) IBOutlet NSButton *recordSwitch;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Stops the recorder and starts playing whatever has been recorded.
+//
+- (IBAction)playFile:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send
+// its delegate (aka this view controller) the audio data in various ways (check
+// out the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleMicrophone:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send
+// its delegate (aka this view controller) the audio data in various ways
+// (check out the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleRecording:(id)sender;
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+////------------------------------------------------------------------------------
+//#pragma mark - Customize the Audio Plot
+////------------------------------------------------------------------------------
+//
+//- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
+//}
+
+- (void)applicationDidFinishLaunching:(NSNotification *)notification {
+ //
+ // Customizing the audio plot that'll show the current microphone
+ // input/recording
+ //
+ self.recordingAudioPlot.backgroundColor = [NSColor colorWithRed: 0.984 green: 0.71 blue: 0.365 alpha: 1];
+ self.recordingAudioPlot.color = [NSColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+ self.recordingAudioPlot.plotType = EZPlotTypeRolling;
+ self.recordingAudioPlot.shouldFill = YES;
+ self.recordingAudioPlot.shouldMirror = YES;
+
+ //
+ // Customizing the audio plot that'll show the playback
+ //
+ self.playingAudioPlot.color = [NSColor whiteColor];
+ self.playingAudioPlot.plotType = EZPlotTypeRolling;
+ self.playingAudioPlot.shouldFill = YES;
+ self.playingAudioPlot.shouldMirror = YES;
+ self.playingAudioPlot.gain = 2.5f;
+
+ //
+ // Create an instance of the microphone and tell it to use this view
+ // controller instance as the delegate
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+ self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
+
+ //
+ // Initialize UI components
+ //
+ [self setTitle:@"Microphone On" forButton:self.microphoneSwitch];
+ [self setTitle:@"Not Recording" forButton:self.recordSwitch];
+ self.playingStateLabel.stringValue = @"Not Playing";
+ self.playButton.enabled = NO;
+
+ //
+ // Setup notifications
+ //
+ [self setupNotifications];
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setupNotifications
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(playerDidChangePlayState:)
+ name:EZAudioPlayerDidChangePlayStateNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(playerDidReachEndOfFile:)
+ name:EZAudioPlayerDidReachEndOfFileNotification
+ object:self.player];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+- (void)playerDidChangePlayState:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ BOOL isPlaying = [player isPlaying];
+ if (isPlaying)
+ {
+ self.recorder.delegate = nil;
+ }
+ self.playingStateLabel.stringValue = isPlaying ? @"Playing" : @"Not Playing";
+ self.playingAudioPlot.hidden = !isPlaying;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)playerDidReachEndOfFile:(NSNotification *)notification
+{
+ [self.playingAudioPlot clear];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)playFile:(id)sender
+{
+ //
+ // Update microphone state
+ //
+ [self.microphone stopFetchingAudio];
+
+ //
+ // Update recording state
+ //
+ self.isRecording = NO;
+ [self setTitle:@"Not Recording" forButton:self.recordSwitch];
+ self.recordSwitch.state = NSOffState;
+
+ //
+ // Close the audio file
+ //
+ if (self.recorder)
+ {
+ [self.recorder closeAudioFile];
+ }
+
+ EZAudioFile *audioFile = [EZAudioFile audioFileWithURL:[NSURL fileURLWithPath:kAudioFilePath]];
+ [self.player playAudioFile:audioFile];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ [self.player pause];
+
+ NSInteger state = [(NSButton *)sender state];
+ if (state == NSOffState)
+ {
+ [self.microphone stopFetchingAudio];
+ }
+ else
+ {
+ [self.microphone startFetchingAudio];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleRecording:(id)sender
+{
+ [self.player pause];
+
+ NSInteger state = [(NSButton *)sender state];
+ if (state == NSOnState)
+ {
+ //
+ // Create the recorder
+ //
+ [self.microphone startFetchingAudio];
+ self.recorder = [EZRecorder recorderWithURL:[NSURL fileURLWithPath:kAudioFilePath]
+ clientFormat:[self.microphone audioStreamBasicDescription]
+ fileType:EZRecorderFileTypeM4A
+ delegate:self];
+ self.playButton.enabled = YES;
+ }
+ self.isRecording = state;
+ NSString *title = self.isRecording ? @"Recording" : @"Not Recording";
+ [self setTitle:title forButton:self.recordSwitch];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
+{
+ self.microphoneSwitch.state = isPlaying;
+ NSString *title = isPlaying ? @"Microphone On" : @"Microphone Off";
+ [self setTitle:title forButton:self.microphoneSwitch];
+}
+
+//------------------------------------------------------------------------------
+
+#warning Thread Safety
+// Note that any callback that provides streamed audio data (like streaming microphone input) happens on a separate audio thread that should not be blocked. When we feed audio data into any of the UI components we need to explicity create a GCD block on the main thread to properly get the UI to work.
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ // Getting audio data as an array of float buffer arrays. What does that mean? Because the audio is coming in as a stereo signal the data is split into a left and right channel. So buffer[0] corresponds to the float* data for the left channel while buffer[1] corresponds to the float* data for the right channel.
+
+ // See the Thread Safety warning above, but in a nutshell these callbacks happen on a separate audio thread. We wrap any UI updating in a GCD block on the main thread to avoid blocking that audio flow.
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // All the audio plot needs is the buffer data (float*) and the size. Internally the audio plot will handle all the drawing related code, history management, and freeing its own resources. Hence, one badass line of code gets you a pretty plot :)
+ [weakSelf.recordingAudioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void) microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ // Getting audio data as a buffer list that can be directly fed into the EZRecorder. This is happening on the audio thread - any UI updating needs a GCD main queue block. This will keep appending data to the tail of the audio file.
+ if (self.isRecording)
+ {
+ [self.recorder appendDataFromBufferList:bufferList
+ withBufferSize:bufferSize];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorderDelegate
+//------------------------------------------------------------------------------
+
+- (void)recorderDidClose:(EZRecorder *)recorder
+{
+ recorder.delegate = nil;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)recorderUpdatedCurrentTime:(EZRecorder *)recorder
+{
+ __weak typeof (self) weakSelf = self;
+ NSString *formattedCurrentTime = [recorder formattedCurrentTime];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.currentTimeLabel.stringValue = formattedCurrentTime;
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayerDelegate
+//------------------------------------------------------------------------------
+
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.playingAudioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.currentTimeLabel.stringValue = [audioPlayer formattedCurrentTime];
+ });
+}
+
+//------------------------------------------------------------------------------
+#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
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="currentTimeLabel" destination="0b2-Xt-uxP" id="RXs-Wr-dDp"/>
+ <outlet property="microphoneSwitch" destination="nX1-e4-cPx" id="Szs-r9-e20"/>
+ <outlet property="playButton" destination="GjH-v7-YKU" id="cbu-F1-0eL"/>
+ <outlet property="playingAudioPlot" destination="cip-Fe-fyq" id="Ufw-ZY-bNA"/>
+ <outlet property="playingStateLabel" destination="nTx-44-hwR" id="AKy-KE-aTC"/>
+ <outlet property="recordSwitch" destination="iy7-wI-EPq" id="Jee-yf-4y7"/>
+ <outlet property="recordingAudioPlot" destination="uPL-pp-zsC" id="Zrr-9Y-Q3x"/>
+ <outlet property="window" destination="QvC-M9-y7g" id="gIp-Ho-8D9"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="RecordFile" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="RecordFile" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About RecordFile" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide RecordFile" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit RecordFile" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="RecordFile Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="RecordFile" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="uPL-pp-zsC" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <subviews>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0b2-Xt-uxP">
+ <rect key="frame" x="16" y="193" width="85" height="39"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="00:00" id="PWJ-TR-A0Q">
+ <font key="font" size="32" name="HelveticaNeue-Light"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="cip-Fe-fyq" customClass="EZAudioPlot">
+ <rect key="frame" x="108" y="193" width="354" height="39"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="39" id="2W3-HN-kAo"/>
+ </constraints>
+ </customView>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="nX1-e4-cPx">
+ <rect key="frame" x="16" y="39" width="119" height="18"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="115" id="0nP-uD-Iwj"/>
+ </constraints>
+ <buttonCell key="cell" type="check" title="Microphone Off" alternateTitle="Microphone On" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="GSu-wR-cvL">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="toggleMicrophone:" target="Voe-Tx-rLC" id="1nT-1P-CdG"/>
+ </connections>
+ </button>
+ <button translatesAutoresizingMaskIntoConstraints="NO" id="iy7-wI-EPq">
+ <rect key="frame" x="16" y="16" width="113" height="18"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="109" id="Pqb-qG-B3j"/>
+ </constraints>
+ <buttonCell key="cell" type="check" title="Not Recording" alternateTitle="Recording" bezelStyle="regularSquare" imagePosition="left" inset="2" id="nBO-YL-xR8">
+ <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="toggleRecording:" target="Voe-Tx-rLC" id="hNs-By-gHq"/>
+ </connections>
+ </button>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="GjH-v7-YKU">
+ <rect key="frame" x="12" y="57" width="65" height="32"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="53" id="2BI-zI-5Fp"/>
+ </constraints>
+ <buttonCell key="cell" type="push" title="Play" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="HYV-iB-x0c">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="playFile:" target="Voe-Tx-rLC" id="evi-EW-61f"/>
+ </connections>
+ </button>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="nTx-44-hwR">
+ <rect key="frame" x="76" y="66" width="74" height="17"/>
+ <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Not Playing" id="Aao-Ay-vg2">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ </subviews>
+ <constraints>
+ <constraint firstItem="nTx-44-hwR" firstAttribute="centerY" secondItem="GjH-v7-YKU" secondAttribute="centerY" id="4wA-Ok-WQA"/>
+ <constraint firstItem="cip-Fe-fyq" firstAttribute="top" secondItem="uPL-pp-zsC" secondAttribute="top" constant="40" id="AGx-ra-bMJ"/>
+ <constraint firstAttribute="bottom" secondItem="iy7-wI-EPq" secondAttribute="bottom" constant="18" id="AtY-dp-C6V"/>
+ <constraint firstItem="0b2-Xt-uxP" firstAttribute="top" secondItem="uPL-pp-zsC" secondAttribute="top" constant="40" id="DbV-15-1z4"/>
+ <constraint firstItem="iy7-wI-EPq" firstAttribute="top" secondItem="nX1-e4-cPx" secondAttribute="bottom" constant="9" id="Mbe-r8-4Ty"/>
+ <constraint firstAttribute="trailing" secondItem="cip-Fe-fyq" secondAttribute="trailing" constant="18" id="V36-ch-Zz1"/>
+ <constraint firstItem="0b2-Xt-uxP" firstAttribute="leading" secondItem="uPL-pp-zsC" secondAttribute="leading" constant="18" id="WpU-TU-8Td"/>
+ <constraint firstItem="nTx-44-hwR" firstAttribute="leading" secondItem="GjH-v7-YKU" secondAttribute="trailing" constant="7" id="fgA-x5-qkt"/>
+ <constraint firstItem="GjH-v7-YKU" firstAttribute="leading" secondItem="0b2-Xt-uxP" secondAttribute="leading" id="hKq-1L-2kL"/>
+ <constraint firstItem="iy7-wI-EPq" firstAttribute="leading" secondItem="nX1-e4-cPx" secondAttribute="leading" id="hry-PY-QKd"/>
+ <constraint firstItem="nX1-e4-cPx" firstAttribute="leading" secondItem="GjH-v7-YKU" secondAttribute="leading" id="jkQ-mh-FgR"/>
+ <constraint firstItem="nX1-e4-cPx" firstAttribute="top" secondItem="GjH-v7-YKU" secondAttribute="bottom" constant="9" id="nSJ-BM-gUL"/>
+ <constraint firstItem="cip-Fe-fyq" firstAttribute="leading" secondItem="0b2-Xt-uxP" secondAttribute="trailing" constant="9" id="sxR-3A-GJL"/>
+ </constraints>
+ </customView>
+ </subviews>
+ <constraints>
+ <constraint firstItem="uPL-pp-zsC" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="Cuy-Fu-dRc"/>
+ <constraint firstItem="uPL-pp-zsC" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="G5s-Zc-VzR"/>
+ <constraint firstAttribute="bottom" secondItem="uPL-pp-zsC" secondAttribute="bottom" id="RUr-Bo-iqk"/>
+ <constraint firstAttribute="trailing" secondItem="uPL-pp-zsC" secondAttribute="trailing" id="Syd-Vf-Zft"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="252" y="327"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// RecordFile
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374D6A1C54456C000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D691C54456C000B19D0 /* AppDelegate.m */; };
+ 66374D6D1C54456C000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374D6C1C54456C000B19D0 /* main.m */; };
+ 66374D6F1C54456C000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374D6E1C54456C000B19D0 /* Assets.xcassets */; };
+ 66374D721C54456C000B19D0 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 66374D701C54456C000B19D0 /* MainMenu.xib */; };
+ 66374D7B1C544584000B19D0 /* simple-drum-beat.wav in Resources */ = {isa = PBXBuildFile; fileRef = 66374D7A1C544584000B19D0 /* simple-drum-beat.wav */; };
+ 66374D7D1C54472A000B19D0 /* EZAudioOSX.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374D7C1C54472A000B19D0 /* EZAudioOSX.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374DFA1C545328000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DF51C545328000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374DFC1C545328000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374DF51C545328000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 66374D651C54456C000B19D0 /* WaveformFromFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WaveformFromFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374D681C54456C000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374D691C54456C000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374D6C1C54456C000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374D6E1C54456C000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374D711C54456C000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
+ 66374D731C54456C000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374D7A1C544584000B19D0 /* simple-drum-beat.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "simple-drum-beat.wav"; path = "../../simple-drum-beat.wav"; sourceTree = SOURCE_ROOT; };
+ 66374D7C1C54472A000B19D0 /* EZAudioOSX.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = EZAudioOSX.framework; path = ../../../build/Debug/EZAudioOSX.framework; sourceTree = "<group>"; };
+ 66374DF51C545328000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374D621C54456C000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D7D1C54472A000B19D0 /* EZAudioOSX.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374D5C1C54456C000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374DF51C545328000B19D0 /* EZAudio.xcodeproj */,
+ 66374D671C54456C000B19D0 /* WaveformFromFile */,
+ 66374D791C544577000B19D0 /* Frameworks */,
+ 66374D661C54456C000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374D661C54456C000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D651C54456C000B19D0 /* WaveformFromFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374D671C54456C000B19D0 /* WaveformFromFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D7A1C544584000B19D0 /* simple-drum-beat.wav */,
+ 66374D681C54456C000B19D0 /* AppDelegate.h */,
+ 66374D691C54456C000B19D0 /* AppDelegate.m */,
+ 66374D6E1C54456C000B19D0 /* Assets.xcassets */,
+ 66374D701C54456C000B19D0 /* MainMenu.xib */,
+ 66374D731C54456C000B19D0 /* Info.plist */,
+ 66374D6B1C54456C000B19D0 /* Supporting Files */,
+ );
+ path = WaveformFromFile;
+ sourceTree = "<group>";
+ };
+ 66374D6B1C54456C000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D6C1C54456C000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374D791C544577000B19D0 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 66374D7C1C54472A000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ 66374DF61C545328000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374DFB1C545328000B19D0 /* EZAudioiOS.framework */,
+ 66374DFD1C545328000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374D641C54456C000B19D0 /* WaveformFromFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374D761C54456C000B19D0 /* Build configuration list for PBXNativeTarget "WaveformFromFile" */;
+ buildPhases = (
+ 66374D611C54456C000B19D0 /* Sources */,
+ 66374D621C54456C000B19D0 /* Frameworks */,
+ 66374D631C54456C000B19D0 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = WaveformFromFile;
+ productName = WaveformFromFile;
+ productReference = 66374D651C54456C000B19D0 /* WaveformFromFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374D5D1C54456C000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374D641C54456C000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ };
+ };
+ };
+ buildConfigurationList = 66374D601C54456C000B19D0 /* Build configuration list for PBXProject "WaveformFromFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 66374D5C1C54456C000B19D0;
+ productRefGroup = 66374D661C54456C000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374DF61C545328000B19D0 /* Products */;
+ ProjectRef = 66374DF51C545328000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374D641C54456C000B19D0 /* WaveformFromFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374DFB1C545328000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374DFA1C545328000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374DFD1C545328000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374DFC1C545328000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374D631C54456C000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D6F1C54456C000B19D0 /* Assets.xcassets in Resources */,
+ 66374D721C54456C000B19D0 /* MainMenu.xib in Resources */,
+ 66374D7B1C544584000B19D0 /* simple-drum-beat.wav in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374D611C54456C000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374D6D1C54456C000B19D0 /* main.m in Sources */,
+ 66374D6A1C54456C000B19D0 /* AppDelegate.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 66374D701C54456C000B19D0 /* MainMenu.xib */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374D711C54456C000B19D0 /* Base */,
+ );
+ name = MainMenu.xib;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374D741C54456C000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = macosx;
+ };
+ name = Debug;
+ };
+ 66374D751C54456C000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ CODE_SIGN_IDENTITY = "-";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ MACOSX_DEPLOYMENT_TARGET = 10.8;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = macosx;
+ };
+ name = Release;
+ };
+ 66374D771C54456C000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = WaveformFromFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.WaveformFromFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374D781C54456C000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ COMBINE_HIDPI_IMAGES = YES;
+ INFOPLIST_FILE = WaveformFromFile/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.WaveformFromFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374D601C54456C000B19D0 /* Build configuration list for PBXProject "WaveformFromFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D741C54456C000B19D0 /* Debug */,
+ 66374D751C54456C000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374D761C54456C000B19D0 /* Build configuration list for PBXNativeTarget "WaveformFromFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374D771C54456C000B19D0 /* Debug */,
+ 66374D781C54456C000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374D5D1C54456C000B19D0 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import <Cocoa/Cocoa.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// Here's the default audio file included with the example
+//
+#define kAudioFileDefault [[NSBundle mainBundle] pathForResource:@"simple-drum-beat" ofType:@"wav"]
+
+//------------------------------------------------------------------------------
+#pragma mark - AppDelegate
+//------------------------------------------------------------------------------
+
+@interface AppDelegate : NSObject <NSApplicationDelegate, NSOpenSavePanelDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The EZAudioFile representing of the currently selected audio file
+//
+@property (nonatomic,strong) EZAudioFile *audioFile;
+
+//------------------------------------------------------------------------------
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlot;
+
+//
+// A label to display the current file path with the waveform shown
+//
+@property (nonatomic,weak) IBOutlet NSTextField *filePathLabel;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Prompts the file manager and loads in a new audio file into the
+// EZAudioFile representation.
+//
+-(IBAction)openFile:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Shows how to take a snapshot of the Core Graphics based waveform and save
+// it to the file path: ~/Documents/waveform.png
+//
+-(IBAction)snapshot:(id)sender;
+
+//------------------------------------------------------------------------------
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#import "AppDelegate.h"
+
+@implementation AppDelegate
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+-(void)applicationDidFinishLaunching:(NSNotification *)notification
+{
+ //
+ // Customizing the audio plot's look
+ //
+
+ //
+ // Background color
+ //
+ self.audioPlot.backgroundColor = [NSColor colorWithCalibratedRed: 0.169 green: 0.643 blue: 0.675 alpha: 1];
+
+ //
+ // Waveform color
+ //
+ self.audioPlot.color = [NSColor colorWithCalibratedRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+
+ //
+ // Plot type
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Fill
+ //
+ self.audioPlot.shouldFill = YES;
+
+ //
+ // Mirror
+ //
+ self.audioPlot.shouldMirror = YES;
+
+ //
+ // Don't optimze for real-time because we don't need to re-render
+ // the view 60 frames per second
+ //
+ self.audioPlot.shouldOptimizeForRealtimePlot = NO;
+
+ //
+ // Customize the layer with a shadow for fun
+ //
+ self.audioPlot.waveformLayer.shadowOffset = CGSizeMake(0.0, -1.0);
+ self.audioPlot.waveformLayer.shadowRadius = 0.0;
+ self.audioPlot.waveformLayer.shadowColor = [NSColor colorWithCalibratedRed: 0.069 green: 0.543 blue: 0.575 alpha: 1].CGColor;
+ self.audioPlot.waveformLayer.shadowOpacity = 1.0;
+
+ //
+ // Open the default file included with the example
+ //
+ [self openFileWithFilePathURL:[NSURL fileURLWithPath:kAudioFileDefault]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)openFile:(id)sender
+{
+ NSOpenPanel *openDlg = [NSOpenPanel openPanel];
+ openDlg.canChooseFiles = YES;
+ openDlg.canChooseDirectories = NO;
+ openDlg.delegate = self;
+ if ([openDlg runModal] == NSModalResponseOK)
+ {
+ NSArray *selectedFiles = [openDlg URLs];
+ [self openFileWithFilePathURL:selectedFiles.firstObject];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)snapshot:(id)sender
+{
+ NSBitmapImageRep *imageRep = [self.audioPlot bitmapImageRepForCachingDisplayInRect:self.audioPlot.bounds];
+ [self.audioPlot cacheDisplayInRect:self.audioPlot.bounds toBitmapImageRep:imageRep];
+ NSData *data = [imageRep representationUsingType:NSPNGFileType properties:@{}];
+ NSString *filePath = [NSString stringWithFormat:@"%@/Documents/waveform.png",NSHomeDirectory()];
+ [data writeToFile:filePath atomically:NO];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+- (void)openFileWithFilePathURL:(NSURL*)filePathURL
+{
+ //
+ // Load the audio file and customize the UI
+ //
+ self.audioFile = [EZAudioFile audioFileWithURL:filePathURL];
+ self.filePathLabel.stringValue = filePathURL.lastPathComponent;
+
+ //
+ // Change back to a buffer plot, but mirror and fill the waveform
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+ [CATransaction begin];
+ [CATransaction setAnimationDuration:0.11f];
+ [self.audioPlot clear];
+ [CATransaction commit];
+
+ //
+ // Plot the whole waveform
+ //
+ __weak typeof (self) weakSelf = self;
+ [self.audioFile getWaveformDataWithNumberOfPoints:1024
+ completion:^(float **waveformData,
+ int length)
+ {
+ [weakSelf.audioPlot updateBuffer:waveformData[0]
+ withBufferSize:length];
+ }];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - NSOpenSavePanelDelegate
+//------------------------------------------------------------------------------
+
+//
+// Here's an example how to filter the open panel to only show the supported
+// file types by the EZAudioFile (which are just the audio file types supported
+// by Core Audio).
+//
+- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
+{
+ NSString *ext = [filename pathExtension];
+ NSArray *fileTypes = [EZAudioFile supportedAudioFileTypes];
+ BOOL isDirectory = [ext isEqualToString:@""];
+ return [fileTypes containsObject:ext] || isDirectory;
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "16x16",
+ "idiom" : "mac",
+ "filename" : "icon_16x16@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "32x32",
+ "idiom" : "mac",
+ "filename" : "icon_32x32@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "128x128",
+ "idiom" : "mac",
+ "filename" : "icon_128x128@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "256x256",
+ "idiom" : "mac",
+ "filename" : "icon_256x256@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "512x512",
+ "idiom" : "mac",
+ "filename" : "icon_512x512@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
+ <dependencies>
+ <deployment identifier="macosx"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9531"/>
+ <capability name="box content view" minToolsVersion="7.0"/>
+ </dependencies>
+ <objects>
+ <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
+ <connections>
+ <outlet property="delegate" destination="Voe-Tx-rLC" id="GzC-gU-4Uq"/>
+ </connections>
+ </customObject>
+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
+ <customObject id="Voe-Tx-rLC" customClass="AppDelegate">
+ <connections>
+ <outlet property="audioPlot" destination="wWu-i2-gfx" id="4qa-dp-6Na"/>
+ <outlet property="filePathLabel" destination="xUE-kw-cPJ" id="hSG-ND-bQK"/>
+ </connections>
+ </customObject>
+ <customObject id="YLy-65-1bz" customClass="NSFontManager"/>
+ <menu title="Main Menu" systemMenu="main" id="AYu-sK-qS6">
+ <items>
+ <menuItem title="WaveformFromFile" id="1Xt-HY-uBw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="WaveformFromFile" systemMenu="apple" id="uQy-DD-JDr">
+ <items>
+ <menuItem title="About WaveformFromFile" id="5kV-Vb-QxS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontStandardAboutPanel:" target="-1" id="Exp-CZ-Vem"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="VOq-y0-SEH"/>
+ <menuItem title="Preferences…" keyEquivalent="," id="BOF-NM-1cW"/>
+ <menuItem isSeparatorItem="YES" id="wFC-TO-SCJ"/>
+ <menuItem title="Services" id="NMo-om-nkz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Services" systemMenu="services" id="hz9-B4-Xy5"/>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4je-JR-u6R"/>
+ <menuItem title="Hide WaveformFromFile" keyEquivalent="h" id="Olw-nP-bQN">
+ <connections>
+ <action selector="hide:" target="-1" id="PnN-Uc-m68"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Hide Others" keyEquivalent="h" id="Vdr-fp-XzO">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="hideOtherApplications:" target="-1" id="VT4-aY-XCT"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Show All" id="Kd2-mp-pUS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unhideAllApplications:" target="-1" id="Dhg-Le-xox"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kCx-OE-vgT"/>
+ <menuItem title="Quit WaveformFromFile" keyEquivalent="q" id="4sb-4s-VLi">
+ <connections>
+ <action selector="terminate:" target="-1" id="Te7-pn-YzF"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="File" id="dMs-cI-mzQ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="File" id="bib-Uj-vzu">
+ <items>
+ <menuItem title="New" keyEquivalent="n" id="Was-JA-tGl">
+ <connections>
+ <action selector="newDocument:" target="-1" id="4Si-XN-c54"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open…" keyEquivalent="o" id="IAo-SY-fd9">
+ <connections>
+ <action selector="openDocument:" target="-1" id="bVn-NM-KNZ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Open Recent" id="tXI-mr-wws">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Open Recent" systemMenu="recentDocuments" id="oas-Oc-fiZ">
+ <items>
+ <menuItem title="Clear Menu" id="vNY-rz-j42">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="clearRecentDocuments:" target="-1" id="Daa-9d-B3U"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="m54-Is-iLE"/>
+ <menuItem title="Close" keyEquivalent="w" id="DVo-aG-piG">
+ <connections>
+ <action selector="performClose:" target="-1" id="HmO-Ls-i7Q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save…" keyEquivalent="s" id="pxx-59-PXV">
+ <connections>
+ <action selector="saveDocument:" target="-1" id="teZ-XB-qJY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Save As…" keyEquivalent="S" id="Bw7-FT-i3A">
+ <connections>
+ <action selector="saveDocumentAs:" target="-1" id="mDf-zr-I0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Revert to Saved" id="KaW-ft-85H">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="revertDocumentToSaved:" target="-1" id="iJ3-Pv-kwq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="aJh-i4-bef"/>
+ <menuItem title="Page Setup…" keyEquivalent="P" id="qIS-W8-SiK">
+ <modifierMask key="keyEquivalentModifierMask" shift="YES" command="YES"/>
+ <connections>
+ <action selector="runPageLayout:" target="-1" id="Din-rz-gC5"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Print…" keyEquivalent="p" id="aTl-1u-JFS">
+ <connections>
+ <action selector="print:" target="-1" id="qaZ-4w-aoO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Edit" id="5QF-Oa-p0T">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Edit" id="W48-6f-4Dl">
+ <items>
+ <menuItem title="Undo" keyEquivalent="z" id="dRJ-4n-Yzg">
+ <connections>
+ <action selector="undo:" target="-1" id="M6e-cu-g7V"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Redo" keyEquivalent="Z" id="6dh-zS-Vam">
+ <connections>
+ <action selector="redo:" target="-1" id="oIA-Rs-6OD"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="WRV-NI-Exz"/>
+ <menuItem title="Cut" keyEquivalent="x" id="uRl-iY-unG">
+ <connections>
+ <action selector="cut:" target="-1" id="YJe-68-I9s"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy" keyEquivalent="c" id="x3v-GG-iWU">
+ <connections>
+ <action selector="copy:" target="-1" id="G1f-GL-Joy"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste" keyEquivalent="v" id="gVA-U4-sdL">
+ <connections>
+ <action selector="paste:" target="-1" id="UvS-8e-Qdg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste and Match Style" keyEquivalent="V" id="WeT-3V-zwk">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteAsPlainText:" target="-1" id="cEh-KX-wJQ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Delete" id="pa3-QI-u2k">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="delete:" target="-1" id="0Mk-Ml-PaM"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Select All" keyEquivalent="a" id="Ruw-6m-B2m">
+ <connections>
+ <action selector="selectAll:" target="-1" id="VNm-Mi-diN"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="uyl-h8-XO2"/>
+ <menuItem title="Find" id="4EN-yA-p0u">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Find" id="1b7-l0-nxx">
+ <items>
+ <menuItem title="Find…" tag="1" keyEquivalent="f" id="Xz5-n4-O0W">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="cD7-Qs-BN4"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find and Replace…" tag="12" keyEquivalent="f" id="YEy-JH-Tfz">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="WD3-Gg-5AJ"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Next" tag="2" keyEquivalent="g" id="q09-fT-Sye">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="NDo-RZ-v9R"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Find Previous" tag="3" keyEquivalent="G" id="OwM-mh-QMV">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="HOh-sY-3ay"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use Selection for Find" tag="7" keyEquivalent="e" id="buJ-ug-pKt">
+ <connections>
+ <action selector="performFindPanelAction:" target="-1" id="U76-nv-p5D"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Jump to Selection" keyEquivalent="j" id="S0p-oC-mLd">
+ <connections>
+ <action selector="centerSelectionInVisibleArea:" target="-1" id="IOG-6D-g5B"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Spelling and Grammar" id="Dv1-io-Yv7">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Spelling" id="3IN-sU-3Bg">
+ <items>
+ <menuItem title="Show Spelling and Grammar" keyEquivalent=":" id="HFo-cy-zxI">
+ <connections>
+ <action selector="showGuessPanel:" target="-1" id="vFj-Ks-hy3"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Document Now" keyEquivalent=";" id="hz2-CU-CR7">
+ <connections>
+ <action selector="checkSpelling:" target="-1" id="fz7-VC-reM"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="bNw-od-mp5"/>
+ <menuItem title="Check Spelling While Typing" id="rbD-Rh-wIN">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleContinuousSpellChecking:" target="-1" id="7w6-Qz-0kB"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Check Grammar With Spelling" id="mK6-2p-4JG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleGrammarChecking:" target="-1" id="muD-Qn-j4w"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Correct Spelling Automatically" id="78Y-hA-62v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticSpellingCorrection:" target="-1" id="2lM-Qi-WAP"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Substitutions" id="9ic-FL-obx">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Substitutions" id="FeM-D8-WVr">
+ <items>
+ <menuItem title="Show Substitutions" id="z6F-FW-3nz">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="orderFrontSubstitutionsPanel:" target="-1" id="oku-mr-iSq"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="gPx-C9-uUO"/>
+ <menuItem title="Smart Copy/Paste" id="9yt-4B-nSM">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleSmartInsertDelete:" target="-1" id="3IJ-Se-DZD"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Quotes" id="hQb-2v-fYv">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticQuoteSubstitution:" target="-1" id="ptq-xd-QOA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Dashes" id="rgM-f4-ycn">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDashSubstitution:" target="-1" id="oCt-pO-9gS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smart Links" id="cwL-P1-jid">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticLinkDetection:" target="-1" id="Gip-E3-Fov"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Data Detectors" id="tRr-pd-1PS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticDataDetection:" target="-1" id="R1I-Nq-Kbl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Text Replacement" id="HFQ-gK-NFA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleAutomaticTextReplacement:" target="-1" id="DvP-Fe-Py6"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Transformations" id="2oI-Rn-ZJC">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Transformations" id="c8a-y6-VQd">
+ <items>
+ <menuItem title="Make Upper Case" id="vmV-6d-7jI">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="uppercaseWord:" target="-1" id="sPh-Tk-edu"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Make Lower Case" id="d9M-CD-aMd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowercaseWord:" target="-1" id="iUZ-b5-hil"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Capitalize" id="UEZ-Bs-lqG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="capitalizeWord:" target="-1" id="26H-TL-nsh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Speech" id="xrE-MZ-jX0">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Speech" id="3rS-ZA-NoH">
+ <items>
+ <menuItem title="Start Speaking" id="Ynk-f8-cLZ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="startSpeaking:" target="-1" id="654-Ng-kyl"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Stop Speaking" id="Oyz-dy-DGm">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="stopSpeaking:" target="-1" id="dX8-6p-jy9"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Format" id="jxT-CU-nIS">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Format" id="GEO-Iw-cKr">
+ <items>
+ <menuItem title="Font" id="Gi5-1S-RQB">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Font" systemMenu="font" id="aXa-aM-Jaq">
+ <items>
+ <menuItem title="Show Fonts" keyEquivalent="t" id="Q5e-8K-NDq">
+ <connections>
+ <action selector="orderFrontFontPanel:" target="YLy-65-1bz" id="WHr-nq-2xA"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Bold" tag="2" keyEquivalent="b" id="GB9-OM-e27">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="hqk-hr-sYV"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Italic" tag="1" keyEquivalent="i" id="Vjx-xi-njq">
+ <connections>
+ <action selector="addFontTrait:" target="YLy-65-1bz" id="IHV-OB-c03"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Underline" keyEquivalent="u" id="WRG-CD-K1S">
+ <connections>
+ <action selector="underline:" target="-1" id="FYS-2b-JAY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="5gT-KC-WSO"/>
+ <menuItem title="Bigger" tag="3" keyEquivalent="+" id="Ptp-SP-VEL">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="Uc7-di-UnL"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Smaller" tag="4" keyEquivalent="-" id="i1d-Er-qST">
+ <connections>
+ <action selector="modifyFont:" target="YLy-65-1bz" id="HcX-Lf-eNd"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="kx3-Dk-x3B"/>
+ <menuItem title="Kern" id="jBQ-r6-VK2">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Kern" id="tlD-Oa-oAM">
+ <items>
+ <menuItem title="Use Default" id="GUa-eO-cwY">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardKerning:" target="-1" id="6dk-9l-Ckg"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="cDB-IK-hbR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffKerning:" target="-1" id="U8a-gz-Maa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Tighten" id="46P-cB-AYj">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="tightenKerning:" target="-1" id="hr7-Nz-8ro"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Loosen" id="ogc-rX-tC1">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="loosenKerning:" target="-1" id="8i4-f9-FKE"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Ligatures" id="o6e-r0-MWq">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Ligatures" id="w0m-vy-SC9">
+ <items>
+ <menuItem title="Use Default" id="agt-UL-0e3">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useStandardLigatures:" target="-1" id="7uR-wd-Dx6"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use None" id="J7y-lM-qPV">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="turnOffLigatures:" target="-1" id="iX2-gA-Ilz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Use All" id="xQD-1f-W4t">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="useAllLigatures:" target="-1" id="KcB-kA-TuK"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Baseline" id="OaQ-X3-Vso">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Baseline" id="ijk-EB-dga">
+ <items>
+ <menuItem title="Use Default" id="3Om-Ey-2VK">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="unscript:" target="-1" id="0vZ-95-Ywn"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Superscript" id="Rqc-34-cIF">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="superscript:" target="-1" id="3qV-fo-wpU"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Subscript" id="I0S-gh-46l">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="subscript:" target="-1" id="Q6W-4W-IGz"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Raise" id="2h7-ER-AoG">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="raiseBaseline:" target="-1" id="4sk-31-7Q9"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Lower" id="1tx-W0-xDw">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="lowerBaseline:" target="-1" id="OF1-bc-KW4"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="Ndw-q3-faq"/>
+ <menuItem title="Show Colors" keyEquivalent="C" id="bgn-CT-cEk">
+ <connections>
+ <action selector="orderFrontColorPanel:" target="-1" id="mSX-Xz-DV3"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="iMs-zA-UFJ"/>
+ <menuItem title="Copy Style" keyEquivalent="c" id="5Vv-lz-BsD">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="copyFont:" target="-1" id="GJO-xA-L4q"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Style" keyEquivalent="v" id="vKC-jM-MkH">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="pasteFont:" target="-1" id="JfD-CL-leO"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Text" id="Fal-I4-PZk">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Text" id="d9c-me-L2H">
+ <items>
+ <menuItem title="Align Left" keyEquivalent="{" id="ZM1-6Q-yy1">
+ <connections>
+ <action selector="alignLeft:" target="-1" id="zUv-R1-uAa"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Center" keyEquivalent="|" id="VIY-Ag-zcb">
+ <connections>
+ <action selector="alignCenter:" target="-1" id="spX-mk-kcS"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Justify" id="J5U-5w-g23">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="alignJustified:" target="-1" id="ljL-7U-jND"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Align Right" keyEquivalent="}" id="wb2-vD-lq4">
+ <connections>
+ <action selector="alignRight:" target="-1" id="r48-bG-YeY"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="4s2-GY-VfK"/>
+ <menuItem title="Writing Direction" id="H1b-Si-o9J">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Writing Direction" id="8mr-sm-Yjd">
+ <items>
+ <menuItem title="Paragraph" enabled="NO" id="ZvO-Gk-QUH">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="YGs-j5-SAR">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionNatural:" target="-1" id="qtV-5e-UBP"/>
+ </connections>
+ </menuItem>
+ <menuItem id="Lbh-J2-qVU">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionLeftToRight:" target="-1" id="S0X-9S-QSf"/>
+ </connections>
+ </menuItem>
+ <menuItem id="jFq-tB-4Kx">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeBaseWritingDirectionRightToLeft:" target="-1" id="5fk-qB-AqJ"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="swp-gr-a21"/>
+ <menuItem title="Selection" enabled="NO" id="cqv-fj-IhA">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ </menuItem>
+ <menuItem id="Nop-cj-93Q">
+ <string key="title"> Default</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionNatural:" target="-1" id="lPI-Se-ZHp"/>
+ </connections>
+ </menuItem>
+ <menuItem id="BgM-ve-c93">
+ <string key="title"> Left to Right</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionLeftToRight:" target="-1" id="caW-Bv-w94"/>
+ </connections>
+ </menuItem>
+ <menuItem id="RB4-Sm-HuC">
+ <string key="title"> Right to Left</string>
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="makeTextWritingDirectionRightToLeft:" target="-1" id="EXD-6r-ZUu"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="fKy-g9-1gm"/>
+ <menuItem title="Show Ruler" id="vLm-3I-IUL">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="toggleRuler:" target="-1" id="FOx-HJ-KwY"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Copy Ruler" keyEquivalent="c" id="MkV-Pr-PK5">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="copyRuler:" target="-1" id="71i-fW-3W2"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Paste Ruler" keyEquivalent="v" id="LVM-kO-fVI">
+ <modifierMask key="keyEquivalentModifierMask" control="YES" command="YES"/>
+ <connections>
+ <action selector="pasteRuler:" target="-1" id="cSh-wd-qM2"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="View" id="H8h-7b-M4v">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="View" id="HyV-fh-RgO">
+ <items>
+ <menuItem title="Show Toolbar" keyEquivalent="t" id="snW-S8-Cw5">
+ <modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
+ <connections>
+ <action selector="toggleToolbarShown:" target="-1" id="BXY-wc-z0C"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Customize Toolbar…" id="1UK-8n-QPP">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="runToolbarCustomizationPalette:" target="-1" id="pQI-g3-MTW"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Window" id="aUF-d1-5bR">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Window" systemMenu="window" id="Td7-aD-5lo">
+ <items>
+ <menuItem title="Minimize" keyEquivalent="m" id="OY7-WF-poV">
+ <connections>
+ <action selector="performMiniaturize:" target="-1" id="VwT-WD-YPe"/>
+ </connections>
+ </menuItem>
+ <menuItem title="Zoom" id="R4o-n2-Eq4">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="performZoom:" target="-1" id="DIl-cC-cCs"/>
+ </connections>
+ </menuItem>
+ <menuItem isSeparatorItem="YES" id="eu3-7i-yIM"/>
+ <menuItem title="Bring All to Front" id="LE2-aR-0XJ">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <connections>
+ <action selector="arrangeInFront:" target="-1" id="DRN-fu-gQh"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ <menuItem title="Help" id="wpr-3q-Mcd">
+ <modifierMask key="keyEquivalentModifierMask"/>
+ <menu key="submenu" title="Help" systemMenu="help" id="F2S-fz-NVQ">
+ <items>
+ <menuItem title="WaveformFromFile Help" keyEquivalent="?" id="FKE-Sm-Kum">
+ <connections>
+ <action selector="showHelp:" target="-1" id="y7X-2Q-9no"/>
+ </connections>
+ </menuItem>
+ </items>
+ </menu>
+ </menuItem>
+ </items>
+ </menu>
+ <window title="WaveformFromFile" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
+ <windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
+ <windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
+ <rect key="contentRect" x="335" y="390" width="480" height="272"/>
+ <rect key="screenRect" x="0.0" y="0.0" width="1440" height="877"/>
+ <view key="contentView" id="EiT-Mj-1SZ">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ <autoresizingMask key="autoresizingMask"/>
+ <subviews>
+ <customView translatesAutoresizingMaskIntoConstraints="NO" id="wWu-i2-gfx" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
+ </customView>
+ <box autoresizesSubviews="NO" title="Box" boxType="custom" borderType="none" translatesAutoresizingMaskIntoConstraints="NO" id="35n-dI-jo8">
+ <rect key="frame" x="0.0" y="193" width="480" height="79"/>
+ <view key="contentView" id="aHo-lW-LwP">
+ <rect key="frame" x="0.0" y="0.0" width="480" height="79"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="FyZ-hg-zJA">
+ <rect key="frame" x="10" y="11" width="125" height="32"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="113" id="gOe-fe-PD7"/>
+ </constraints>
+ <buttonCell key="cell" type="push" title="Choose File..." bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="1u5-j4-dun">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="openFile:" target="Voe-Tx-rLC" id="qt7-92-VqV"/>
+ </connections>
+ </button>
+ <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xUE-kw-cPJ">
+ <rect key="frame" x="137" y="22" width="213" height="17"/>
+ <textFieldCell key="cell" lineBreakMode="truncatingMiddle" sendsActionOnEndEditing="YES" title="Label" id="93q-MH-Out">
+ <font key="font" metaFont="system"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
+ </textFieldCell>
+ </textField>
+ <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="M2c-aD-7AV">
+ <rect key="frame" x="371" y="11" width="97" height="32"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="85" id="u6w-Ck-tSd"/>
+ </constraints>
+ <buttonCell key="cell" type="push" title="Snapshot" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="lq9-JI-AQM">
+ <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
+ <font key="font" metaFont="system"/>
+ </buttonCell>
+ <connections>
+ <action selector="snapshot:" target="Voe-Tx-rLC" id="7Rk-D5-8ZU"/>
+ </connections>
+ </button>
+ </subviews>
+ </view>
+ <constraints>
+ <constraint firstItem="FyZ-hg-zJA" firstAttribute="leading" secondItem="35n-dI-jo8" secondAttribute="leading" constant="16" id="0Nf-ju-Ooy"/>
+ <constraint firstItem="M2c-aD-7AV" firstAttribute="leading" secondItem="xUE-kw-cPJ" secondAttribute="trailing" constant="29" id="2zR-EJ-yKQ"/>
+ <constraint firstAttribute="trailing" secondItem="M2c-aD-7AV" secondAttribute="trailing" constant="18" id="OaL-o8-wbY"/>
+ <constraint firstItem="M2c-aD-7AV" firstAttribute="baseline" secondItem="FyZ-hg-zJA" secondAttribute="baseline" id="RCg-tc-Eda"/>
+ <constraint firstItem="M2c-aD-7AV" firstAttribute="centerY" secondItem="35n-dI-jo8" secondAttribute="centerY" constant="11" id="Sn5-Dr-4Wg"/>
+ <constraint firstItem="xUE-kw-cPJ" firstAttribute="top" secondItem="M2c-aD-7AV" secondAttribute="top" id="eep-aR-TkC"/>
+ <constraint firstItem="xUE-kw-cPJ" firstAttribute="leading" secondItem="FyZ-hg-zJA" secondAttribute="trailing" constant="10" id="peo-ON-FoN"/>
+ <constraint firstItem="FyZ-hg-zJA" firstAttribute="top" secondItem="35n-dI-jo8" secondAttribute="top" constant="40" id="zH3-BX-Yqk"/>
+ </constraints>
+ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
+ <color key="fillColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="calibratedRGB"/>
+ </box>
+ </subviews>
+ <constraints>
+ <constraint firstItem="wWu-i2-gfx" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="FOl-di-e3N"/>
+ <constraint firstAttribute="bottom" secondItem="wWu-i2-gfx" secondAttribute="bottom" id="Ime-jJ-td6"/>
+ <constraint firstItem="35n-dI-jo8" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="b2e-Sq-14T"/>
+ <constraint firstAttribute="trailing" secondItem="35n-dI-jo8" secondAttribute="trailing" id="k4X-fk-Nkv"/>
+ <constraint firstAttribute="trailing" secondItem="wWu-i2-gfx" secondAttribute="trailing" id="lvU-Sq-l8S"/>
+ <constraint firstItem="wWu-i2-gfx" firstAttribute="top" secondItem="EiT-Mj-1SZ" secondAttribute="top" id="qmz-Ws-uxi"/>
+ <constraint firstItem="35n-dI-jo8" firstAttribute="leading" secondItem="EiT-Mj-1SZ" secondAttribute="leading" id="sSt-Wg-uN6"/>
+ </constraints>
+ </view>
+ <point key="canvasLocation" x="235" y="358"/>
+ </window>
+ </objects>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSMinimumSystemVersion</key>
+ <string>$(MACOSX_DEPLOYMENT_TARGET)</string>
+ <key>NSHumanReadableCopyright</key>
+ <string>Copyright © 2016 Syed Haris Ali. All rights reserved.</string>
+ <key>NSMainNibFile</key>
+ <string>MainMenu</string>
+ <key>NSPrincipalClass</key>
+ <string>NSApplication</string>
+</dict>
+</plist>
--- /dev/null
+//
+// main.m
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 1/23/16.
+// Copyright © 2016 Syed Haris Ali. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+int main(int argc, const char * argv[]) {
+ return NSApplicationMain(argc, argv);
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374E1C1C545A8A000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E1B1C545A8A000B19D0 /* main.m */; };
+ 66374E1F1C545A8A000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E1E1C545A8A000B19D0 /* AppDelegate.m */; };
+ 66374E221C545A8A000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E211C545A8A000B19D0 /* ViewController.m */; };
+ 66374E251C545A8A000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E231C545A8A000B19D0 /* Main.storyboard */; };
+ 66374E271C545A8A000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374E261C545A8A000B19D0 /* Assets.xcassets */; };
+ 66374E2A1C545A8A000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E281C545A8A000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F611C5464F4000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F3F1C545B59000B19D0 /* EZAudioiOS.framework */; };
+ 66374F621C5464F4000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F3F1C545B59000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F3E1C545B59000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F401C545B59000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F5E1C5464C3000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F631C5464F4000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F651C5464F4000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F621C5464F4000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374E171C545A8A000B19D0 /* CoreGraphicsWaveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CoreGraphicsWaveform.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374E1B1C545A8A000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E1D1C545A8A000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374E1E1C545A8A000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E201C545A8A000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374E211C545A8A000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E241C545A8A000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374E261C545A8A000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374E291C545A8A000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374E2B1C545A8A000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374E141C545A8A000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F611C5464F4000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374E0E1C545A8A000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */,
+ 66374E191C545A8A000B19D0 /* CoreGraphicsWaveform */,
+ 66374E181C545A8A000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374E181C545A8A000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E171C545A8A000B19D0 /* CoreGraphicsWaveform.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374E191C545A8A000B19D0 /* CoreGraphicsWaveform */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E1D1C545A8A000B19D0 /* AppDelegate.h */,
+ 66374E1E1C545A8A000B19D0 /* AppDelegate.m */,
+ 66374E201C545A8A000B19D0 /* ViewController.h */,
+ 66374E211C545A8A000B19D0 /* ViewController.m */,
+ 66374E231C545A8A000B19D0 /* Main.storyboard */,
+ 66374E261C545A8A000B19D0 /* Assets.xcassets */,
+ 66374E281C545A8A000B19D0 /* LaunchScreen.storyboard */,
+ 66374E2B1C545A8A000B19D0 /* Info.plist */,
+ 66374E1A1C545A8A000B19D0 /* Supporting Files */,
+ );
+ path = CoreGraphicsWaveform;
+ sourceTree = "<group>";
+ };
+ 66374E1A1C545A8A000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E1B1C545A8A000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F3A1C545B59000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F3F1C545B59000B19D0 /* EZAudioiOS.framework */,
+ 66374F411C545B59000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374E161C545A8A000B19D0 /* CoreGraphicsWaveform */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374E2E1C545A8A000B19D0 /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */;
+ buildPhases = (
+ 66374E131C545A8A000B19D0 /* Sources */,
+ 66374E141C545A8A000B19D0 /* Frameworks */,
+ 66374E151C545A8A000B19D0 /* Resources */,
+ 66374F651C5464F4000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F5F1C5464C3000B19D0 /* PBXTargetDependency */,
+ 66374F641C5464F4000B19D0 /* PBXTargetDependency */,
+ );
+ name = CoreGraphicsWaveform;
+ productName = CoreGraphicsWaveform;
+ productReference = 66374E171C545A8A000B19D0 /* CoreGraphicsWaveform.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374E0F1C545A8A000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374E161C545A8A000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374E121C545A8A000B19D0 /* Build configuration list for PBXProject "CoreGraphicsWaveform" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374E0E1C545A8A000B19D0;
+ productRefGroup = 66374E181C545A8A000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F3A1C545B59000B19D0 /* Products */;
+ ProjectRef = 66374F391C545B59000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374E161C545A8A000B19D0 /* CoreGraphicsWaveform */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F3F1C545B59000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F3E1C545B59000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F411C545B59000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F401C545B59000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374E151C545A8A000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E2A1C545A8A000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374E271C545A8A000B19D0 /* Assets.xcassets in Resources */,
+ 66374E251C545A8A000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374E131C545A8A000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E221C545A8A000B19D0 /* ViewController.m in Sources */,
+ 66374E1F1C545A8A000B19D0 /* AppDelegate.m in Sources */,
+ 66374E1C1C545A8A000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F5F1C5464C3000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F5E1C5464C3000B19D0 /* PBXContainerItemProxy */;
+ };
+ 66374F641C5464F4000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F631C5464F4000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374E231C545A8A000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E241C545A8A000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374E281C545A8A000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E291C545A8A000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374E2C1C545A8A000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374E2D1C545A8A000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374E2F1C545A8A000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374E301C545A8A000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = CoreGraphicsWaveform/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.CoreGraphicsWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374E121C545A8A000B19D0 /* Build configuration list for PBXProject "CoreGraphicsWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E2C1C545A8A000B19D0 /* Debug */,
+ 66374E2D1C545A8A000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374E2E1C545A8A000B19D0 /* Build configuration list for PBXNativeTarget "CoreGraphicsWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E2F1C545A8A000B19D0 /* Debug */,
+ 66374E301C545A8A000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374E0F1C545A8A000B19D0 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.h
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="VVE-1A-cqe">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="rfa-Yl-ZLy">
+ <objects>
+ <viewController id="VVE-1A-cqe" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="roL-rP-TbW"/>
+ <viewControllerLayoutGuide type="bottom" id="Vyk-X1-klK"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="jGo-0u-sSj">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Rzq-Yi-IN7" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </view>
+ <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="LOY-0w-MaL">
+ <rect key="frame" x="16" y="520" width="157" height="29"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="157" id="LbH-hf-3te"/>
+ </constraints>
+ <segments>
+ <segment title="Buffer"/>
+ <segment title="Rolling"/>
+ </segments>
+ <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="changePlotType:" destination="VVE-1A-cqe" eventType="valueChanged" id="s2D-Ub-Ghc"/>
+ </connections>
+ </segmentedControl>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="oDc-7s-ORm">
+ <rect key="frame" x="16" y="556" width="568" height="28"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <state key="normal" title="Change Microphone Input">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="toggleMicrophonePickerView:" destination="VVE-1A-cqe" eventType="touchUpInside" id="87u-5U-uoh"/>
+ </connections>
+ </button>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="3Qr-bd-WoG">
+ <rect key="frame" x="16" y="479" width="51" height="31"/>
+ <color key="onTintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="toggleMicrophone:" destination="VVE-1A-cqe" eventType="touchUpInside" id="WgY-ud-zXC"/>
+ </connections>
+ </switch>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="CmL-jc-Qh5">
+ <rect key="frame" x="73" y="487" width="33" height="16"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="0.90000000000000002" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1MI-Rk-5WN">
+ <rect key="frame" x="0.0" y="-216" width="600" height="216"/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </pickerView>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="Rzq-Yi-IN7" firstAttribute="leading" secondItem="jGo-0u-sSj" secondAttribute="leading" id="3B2-cv-QVs"/>
+ <constraint firstItem="LOY-0w-MaL" firstAttribute="top" secondItem="3Qr-bd-WoG" secondAttribute="bottom" constant="10" id="4wF-gJ-pgC"/>
+ <constraint firstItem="LOY-0w-MaL" firstAttribute="leading" secondItem="jGo-0u-sSj" secondAttribute="leading" constant="16" id="5mE-di-oUa"/>
+ <constraint firstAttribute="trailing" secondItem="Rzq-Yi-IN7" secondAttribute="trailing" id="6Sb-Bo-0wK"/>
+ <constraint firstItem="Vyk-X1-klK" firstAttribute="top" secondItem="Rzq-Yi-IN7" secondAttribute="bottom" id="8Sc-T9-Q3z"/>
+ <constraint firstItem="LOY-0w-MaL" firstAttribute="top" secondItem="CmL-jc-Qh5" secondAttribute="bottom" constant="17" id="BXP-tk-dIP"/>
+ <constraint firstItem="Rzq-Yi-IN7" firstAttribute="top" secondItem="1MI-Rk-5WN" secondAttribute="bottom" id="H5y-KA-GCk"/>
+ <constraint firstAttribute="trailing" secondItem="1MI-Rk-5WN" secondAttribute="trailing" id="H9a-Kc-oAK"/>
+ <constraint firstItem="Vyk-X1-klK" firstAttribute="top" secondItem="oDc-7s-ORm" secondAttribute="bottom" constant="16" id="L3n-Xr-76Y"/>
+ <constraint firstItem="3Qr-bd-WoG" firstAttribute="leading" secondItem="jGo-0u-sSj" secondAttribute="leading" constant="16" id="QIz-pt-XLo"/>
+ <constraint firstItem="oDc-7s-ORm" firstAttribute="top" secondItem="LOY-0w-MaL" secondAttribute="bottom" constant="8" id="QWe-rK-vQh"/>
+ <constraint firstAttribute="trailing" secondItem="oDc-7s-ORm" secondAttribute="trailing" constant="16" id="YKg-xa-iHD"/>
+ <constraint firstItem="CmL-jc-Qh5" firstAttribute="leading" secondItem="3Qr-bd-WoG" secondAttribute="trailing" constant="8" symbolic="YES" id="gUA-Bq-3bf"/>
+ <constraint firstItem="oDc-7s-ORm" firstAttribute="leading" secondItem="jGo-0u-sSj" secondAttribute="leading" constant="16" id="kDH-dU-DEo"/>
+ <constraint firstItem="1MI-Rk-5WN" firstAttribute="leading" secondItem="jGo-0u-sSj" secondAttribute="leading" id="owp-6I-RIi"/>
+ <constraint firstItem="3Qr-bd-WoG" firstAttribute="leading" secondItem="LOY-0w-MaL" secondAttribute="leading" id="uYr-TW-5iu"/>
+ <constraint firstItem="1MI-Rk-5WN" firstAttribute="top" secondItem="jGo-0u-sSj" secondAttribute="topMargin" constant="-216" id="zGl-dS-8cr"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="audioPlot" destination="Rzq-Yi-IN7" id="CYm-3x-eqw"/>
+ <outlet property="microphoneInputPickerView" destination="1MI-Rk-5WN" id="Xgt-fX-Z2w"/>
+ <outlet property="microphoneInputPickerViewTopConstraint" destination="zGl-dS-8cr" id="DSi-sx-AqP"/>
+ <outlet property="microphoneInputToggleButton" destination="oDc-7s-ORm" id="RXg-P9-Cl1"/>
+ <outlet property="microphoneTextLabel" destination="CmL-jc-Qh5" id="OXX-dE-jey"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="3QZ-yS-IEA" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="574" y="89"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZMicrophoneDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *audioPlot;
+
+//
+// The microphone component
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//
+// The button at the bottom displaying the currently selected microphone input
+//
+@property (nonatomic, weak) IBOutlet UIButton *microphoneInputToggleButton;
+
+//
+// The microphone input picker view to display the different microphone input sources
+//
+@property (nonatomic, weak) IBOutlet UIPickerView *microphoneInputPickerView;
+
+//
+// The microphone input picker view's top layout constraint (we use this to hide the control)
+//
+@property (nonatomic, weak) IBOutlet NSLayoutConstraint *microphoneInputPickerViewTopConstraint;
+
+//
+// The text label displaying "Microphone On" or "Microphone Off"
+//
+@property (nonatomic, weak) IBOutlet UILabel *microphoneTextLabel;
+
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+- (IBAction)changePlotType:(id)sender;
+
+//
+// Toggles the microphone inputs picker view in and out of display.
+//
+- (IBAction)toggleMicrophonePickerView:(id)sender;
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleMicrophone:(id)sender;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// ViewController.m
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface ViewController ()
+@property (nonatomic, strong) NSArray *inputs;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - View Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Customizing the audio plot's look
+ //
+
+ //
+ // Background color
+ //
+ self.audioPlot.backgroundColor = [UIColor colorWithRed:0.984 green:0.471 blue:0.525 alpha:1.0];
+
+ //
+ // Waveform color
+ //
+ self.audioPlot.color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+
+ //
+ // Plot type
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Create the microphone
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Set up the microphone input UIPickerView items to select
+ // between different microphone inputs. Here what we're doing behind the hood
+ // is enumerating the available inputs provided by the AVAudioSession.
+ //
+ self.inputs = [EZAudioDevice inputDevices];
+ self.microphoneInputPickerView.dataSource = self;
+ self.microphoneInputPickerView.delegate = self;
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - UIPickerViewDataSource
+//------------------------------------------------------------------------------
+
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
+{
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)pickerView:(UIPickerView *)pickerView
+ titleForRow:(NSInteger)row
+ forComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ return device.name;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSAttributedString *)pickerView:(UIPickerView *)pickerView
+ attributedTitleForRow:(NSInteger)row
+ forComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ UIColor *textColor = [device isEqual:self.microphone.device] ? self.audioPlot.backgroundColor : [UIColor blackColor];
+ return [[NSAttributedString alloc] initWithString:device.name
+ attributes:@{ NSForegroundColorAttributeName : textColor }];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
+{
+ return self.inputs.count;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ [self.microphone setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegmentIndex];
+ switch (selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ BOOL isOn = [sender isOn];
+ if (!isOn)
+ {
+ [self.microphone stopFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone Off";
+ }
+ else
+ {
+ [self.microphone startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophonePickerView:(id)sender
+{
+ BOOL isHidden = self.microphoneInputPickerViewTopConstraint.constant != 0.0;
+ [self setMicrophonePickerViewHidden:!isHidden];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setMicrophonePickerViewHidden:(BOOL)hidden
+{
+ CGFloat pickerHeight = CGRectGetHeight(self.microphoneInputPickerView.bounds);
+ __weak typeof(self) weakSelf = self;
+ [UIView animateWithDuration:0.55
+ delay:0.0
+ usingSpringWithDamping:0.6
+ initialSpringVelocity:0.5
+ options:(UIViewAnimationOptionBeginFromCurrentState|
+ UIViewAnimationOptionCurveEaseInOut|
+ UIViewAnimationOptionLayoutSubviews)
+ animations:^{
+ weakSelf.microphoneInputPickerViewTopConstraint.constant = hidden ? -pickerHeight : 0.0f;
+ [weakSelf.view layoutSubviews];
+ } completion:nil];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
+//
+// Give the visualization of the current buffer (this is almost exactly the
+// openFrameworks audio input eample)
+//
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+//
+// Give the classic mirrored, rolling waveform look
+//
+-(void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+#pragma mark - EZMicrophoneDelegate
+#warning Thread Safety
+//
+// Note that any callback that provides streamed audio data (like streaming
+// microphone input) happens on a separate audio thread that should not be
+// blocked. When we feed audio data into any of the UI components we need to
+// explicity create a GCD block on the main thread to properly get the UI
+// to work.
+//
+- (void)microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as an array of float buffer arrays. What does that mean?
+ // Because the audio is coming in as a stereo signal the data is split into
+ // a left and right channel. So buffer[0] corresponds to the float* data
+ // for the left channel while buffer[1] corresponds to the float* data
+ // for the right channel.
+ //
+
+ //
+ // See the Thread Safety warning above, but in a nutshell these callbacks
+ // happen on a separate audio thread. We wrap any UI updating in a GCD block
+ // on the main thread to avoid blocking that audio flow.
+ //
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ //
+ // All the audio plot needs is the buffer data (float*) and the size.
+ // Internally the audio plot will handle all the drawing related code,
+ // history management, and freeing its own resources.
+ // Hence, one badass line of code gets you a pretty plot :)
+ //
+ [weakSelf.audioPlot updateBuffer:buffer[0] withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ //
+ // The AudioStreamBasicDescription of the microphone stream. This is useful
+ // when configuring the EZRecorder or telling another component what
+ // audio format type to expect.
+ //
+ [EZAudioUtilities printASBD:audioStreamBasicDescription];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as a buffer list that can be directly fed into the
+ // EZRecorder or EZOutput. Say whattt...
+ //
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device
+{
+ NSLog(@"Microphone changed device: %@", device.name);
+
+ //
+ // Called anytime the microphone's device changes
+ //
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSString *name = device.name;
+ NSString *tapText = @" (Tap To Change)";
+ NSString *microphoneInputToggleButtonText = [NSString stringWithFormat:@"%@%@", device.name, tapText];
+ NSRange rangeOfName = [microphoneInputToggleButtonText rangeOfString:name];
+ NSMutableAttributedString *microphoneInputToggleButtonAttributedText = [[NSMutableAttributedString alloc] initWithString:microphoneInputToggleButtonText];
+ [microphoneInputToggleButtonAttributedText addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:13.0f] range:rangeOfName];
+ [weakSelf.microphoneInputToggleButton setAttributedTitle:microphoneInputToggleButtonAttributedText forState:UIControlStateNormal];
+
+ //
+ // Reset the device list (a device may have been plugged in/out)
+ //
+ weakSelf.inputs = [EZAudioDevice inputDevices];
+ [weakSelf.microphoneInputPickerView reloadAllComponents];
+ [weakSelf setMicrophonePickerViewHidden:YES];
+ });
+}
+
+@end
--- /dev/null
+//
+// main.m
+// CoreGraphicsWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "group:CoreGraphicsWaveform/CoreGraphicsWaveform.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:OpenGLWaveform/OpenGLWaveform.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:PlayFile/PlayFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:RecordFile/RecordFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:WaveformFromFile/WaveformFromFile.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:FFT/FFT.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:PassThrough/PassThrough.xcodeproj">
+ </FileRef>
+</Workspace>
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374EEE1C545B18000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EED1C545B18000B19D0 /* main.m */; };
+ 66374EF11C545B18000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EF01C545B18000B19D0 /* AppDelegate.m */; };
+ 66374EF41C545B18000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EF31C545B18000B19D0 /* ViewController.m */; };
+ 66374EF71C545B18000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374EF51C545B18000B19D0 /* Main.storyboard */; };
+ 66374EF91C545B18000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374EF81C545B18000B19D0 /* Assets.xcassets */; };
+ 66374EFC1C545B18000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374EFA1C545B18000B19D0 /* LaunchScreen.storyboard */; };
+ 66374FA71C548622000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F091C545B48000B19D0 /* EZAudioiOS.framework */; };
+ 66374FA81C548622000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F091C545B48000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F081C545B48000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F0A1C545B48000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374FA91C548622000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374FAB1C548622000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374FA81C548622000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374EE91C545B18000B19D0 /* FFT.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FFT.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374EED1C545B18000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374EEF1C545B18000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374EF01C545B18000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374EF21C545B18000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = ViewController.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374EF31C545B18000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374EF61C545B18000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374EF81C545B18000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374EFB1C545B18000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374EFD1C545B18000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374EE61C545B18000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374FA71C548622000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374EE01C545B18000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */,
+ 66374EEB1C545B18000B19D0 /* FFT */,
+ 66374EEA1C545B18000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374EEA1C545B18000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EE91C545B18000B19D0 /* FFT.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374EEB1C545B18000B19D0 /* FFT */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EEF1C545B18000B19D0 /* AppDelegate.h */,
+ 66374EF01C545B18000B19D0 /* AppDelegate.m */,
+ 66374EF21C545B18000B19D0 /* ViewController.h */,
+ 66374EF31C545B18000B19D0 /* ViewController.m */,
+ 66374EF51C545B18000B19D0 /* Main.storyboard */,
+ 66374EF81C545B18000B19D0 /* Assets.xcassets */,
+ 66374EFA1C545B18000B19D0 /* LaunchScreen.storyboard */,
+ 66374EFD1C545B18000B19D0 /* Info.plist */,
+ 66374EEC1C545B18000B19D0 /* Supporting Files */,
+ );
+ path = FFT;
+ sourceTree = "<group>";
+ };
+ 66374EEC1C545B18000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EED1C545B18000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F041C545B48000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F091C545B48000B19D0 /* EZAudioiOS.framework */,
+ 66374F0B1C545B48000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374EE81C545B18000B19D0 /* FFT */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374F001C545B18000B19D0 /* Build configuration list for PBXNativeTarget "FFT" */;
+ buildPhases = (
+ 66374EE51C545B18000B19D0 /* Sources */,
+ 66374EE61C545B18000B19D0 /* Frameworks */,
+ 66374EE71C545B18000B19D0 /* Resources */,
+ 66374FAB1C548622000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374FAA1C548622000B19D0 /* PBXTargetDependency */,
+ );
+ name = FFT;
+ productName = FFT;
+ productReference = 66374EE91C545B18000B19D0 /* FFT.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374EE11C545B18000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374EE81C545B18000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374EE41C545B18000B19D0 /* Build configuration list for PBXProject "FFT" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374EE01C545B18000B19D0;
+ productRefGroup = 66374EEA1C545B18000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F041C545B48000B19D0 /* Products */;
+ ProjectRef = 66374F031C545B48000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374EE81C545B18000B19D0 /* FFT */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F091C545B48000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F081C545B48000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F0B1C545B48000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F0A1C545B48000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374EE71C545B18000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374EFC1C545B18000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374EF91C545B18000B19D0 /* Assets.xcassets in Resources */,
+ 66374EF71C545B18000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374EE51C545B18000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374EF41C545B18000B19D0 /* ViewController.m in Sources */,
+ 66374EF11C545B18000B19D0 /* AppDelegate.m in Sources */,
+ 66374EEE1C545B18000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374FAA1C548622000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374FA91C548622000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374EF51C545B18000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374EF61C545B18000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374EFA1C545B18000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374EFB1C545B18000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374EFE1C545B18000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374EFF1C545B18000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374F011C545B18000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = FFT/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.FFT;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374F021C545B18000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = FFT/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.FFT;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374EE41C545B18000B19D0 /* Build configuration list for PBXProject "FFT" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374EFE1C545B18000B19D0 /* Debug */,
+ 66374EFF1C545B18000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374F001C545B18000B19D0 /* Build configuration list for PBXNativeTarget "FFT" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374F011C545B18000B19D0 /* Debug */,
+ 66374F021C545B18000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374EE11C545B18000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="DbL-8D-S45">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="Sw2-F1-aLn">
+ <objects>
+ <viewController id="DbL-8D-S45" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="7Wg-WK-eWr"/>
+ <viewControllerLayoutGuide type="bottom" id="Vea-Mg-aEM"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="xgX-Wf-0FU" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="5IB-r8-siZ" customClass="EZAudioPlot">
+ <rect key="frame" x="18" y="18" width="564" height="64"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="64" id="vqq-R9-K8s"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
+ <color key="value" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
+ </userDefinedRuntimeAttribute>
+ <userDefinedRuntimeAttribute type="color" keyPath="color">
+ <color key="value" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </userDefinedRuntimeAttribute>
+ </userDefinedRuntimeAttributes>
+ </view>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SR2-to-91D">
+ <rect key="frame" x="18" y="100" width="0.0" height="0.0"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="18"/>
+ <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="SR2-to-91D" firstAttribute="top" secondItem="5IB-r8-siZ" secondAttribute="bottom" constant="18" id="6Bn-YP-UIt"/>
+ <constraint firstItem="SR2-to-91D" firstAttribute="leading" secondItem="5IB-r8-siZ" secondAttribute="leading" id="6hX-AB-2Ac"/>
+ <constraint firstItem="5IB-r8-siZ" firstAttribute="top" secondItem="xgX-Wf-0FU" secondAttribute="top" constant="18" id="Yui-c4-P4p"/>
+ <constraint firstAttribute="trailing" secondItem="5IB-r8-siZ" secondAttribute="trailing" constant="18" id="YvS-Rk-tXF"/>
+ <constraint firstItem="5IB-r8-siZ" firstAttribute="leading" secondItem="xgX-Wf-0FU" secondAttribute="leading" constant="18" id="lNc-2M-8uf"/>
+ </constraints>
+ <userDefinedRuntimeAttributes>
+ <userDefinedRuntimeAttribute type="color" keyPath="backgroundColor">
+ <color key="value" red="0.0078431372550000003" green="0.72156862749999995" blue="0.96078431369999995" alpha="1" colorSpace="calibratedRGB"/>
+ </userDefinedRuntimeAttribute>
+ <userDefinedRuntimeAttribute type="color" keyPath="color">
+ <color key="value" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </userDefinedRuntimeAttribute>
+ </userDefinedRuntimeAttributes>
+ </view>
+ <connections>
+ <outlet property="audioPlotFreq" destination="xgX-Wf-0FU" id="dFW-E2-30o"/>
+ <outlet property="audioPlotTime" destination="5IB-r8-siZ" id="GIX-Ou-bz3"/>
+ <outlet property="maxFrequencyLabel" destination="SR2-to-91D" id="27E-ab-sDI"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="tyD-VZ-2C9" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="537" y="40"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZMicrophoneDelegate, EZAudioFFTDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// EZAudioPlot for frequency plot
+//
+@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlotFreq;
+
+//
+// EZAudioPlot for time plot
+//
+@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlotTime;
+
+//
+// A label used to display the maximum frequency (i.e. the frequency with the
+// highest energy) calculated from the FFT.
+//
+@property (nonatomic, weak) IBOutlet UILabel *maxFrequencyLabel;
+
+//
+// The microphone used to get input.
+//
+@property (nonatomic,strong) EZMicrophone *microphone;
+
+//
+// Used to calculate a rolling FFT of the incoming audio data.
+//
+@property (nonatomic, strong) EZAudioFFTRolling *fft;
+
+
+@end
+
--- /dev/null
+//
+// ViewController.m
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+static vDSP_Length const FFTViewControllerFFTWindowSize = 4096;
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Status Bar Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - View Lifecycle
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Setup time domain audio plot
+ //
+ self.audioPlotTime.plotType = EZPlotTypeBuffer;
+ self.maxFrequencyLabel.numberOfLines = 0;
+
+ //
+ // Setup frequency domain audio plot
+ //
+ self.audioPlotFreq.shouldFill = YES;
+ self.audioPlotFreq.plotType = EZPlotTypeBuffer;
+ self.audioPlotFreq.shouldCenterYAxis = NO;
+
+ //
+ // Create an instance of the microphone and tell it to use this view controller instance as the delegate
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Create an instance of the EZAudioFFTRolling to keep a history of the incoming audio data and calculate the FFT.
+ //
+ self.fft = [EZAudioFFTRolling fftWithWindowSize:FFTViewControllerFFTWindowSize
+ sampleRate:self.microphone.audioStreamBasicDescription.mSampleRate
+ delegate:self];
+
+ //
+ // Start the mic
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+-(void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Calculate the FFT, will trigger EZAudioFFTDelegate
+ //
+ [self.fft computeFFTWithBuffer:buffer[0] withBufferSize:bufferSize];
+
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlotTime updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioFFTDelegate
+//------------------------------------------------------------------------------
+
+- (void) fft:(EZAudioFFT *)fft
+ updatedWithFFTData:(float *)fftData
+ bufferSize:(vDSP_Length)bufferSize
+{
+ float maxFrequency = [fft maxFrequency];
+ NSString *noteName = [EZAudioUtilities noteNameStringForFrequency:maxFrequency
+ includeOctave:YES];
+
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.maxFrequencyLabel.text = [NSString stringWithFormat:@"Highest Note: %@,\nFrequency: %.2f", noteName, maxFrequency];
+ [weakSelf.audioPlotFreq updateBuffer:fftData withBufferSize:(UInt32)bufferSize];
+ });
+}
+
+@end
--- /dev/null
+//
+// main.m
+// FFT
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374E3F1C545AA8000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E3E1C545AA8000B19D0 /* main.m */; };
+ 66374E421C545AA8000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E411C545AA8000B19D0 /* AppDelegate.m */; };
+ 66374E451C545AA8000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E441C545AA8000B19D0 /* ViewController.m */; };
+ 66374E481C545AA8000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E461C545AA8000B19D0 /* Main.storyboard */; };
+ 66374E4A1C545AA8000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374E491C545AA8000B19D0 /* Assets.xcassets */; };
+ 66374E4D1C545AA8000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E4B1C545AA8000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F6F1C547109000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F361C545B57000B19D0 /* EZAudioiOS.framework */; };
+ 66374F701C547109000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F361C545B57000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F351C545B57000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F371C545B57000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F711C547109000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F731C547109000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F701C547109000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374E3A1C545AA8000B19D0 /* OpenGLWaveform.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = OpenGLWaveform.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374E3E1C545AA8000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = main.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E401C545AA8000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374E411C545AA8000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E431C545AA8000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 66374E441C545AA8000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = ViewController.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374E471C545AA8000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374E491C545AA8000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374E4C1C545AA8000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374E4E1C545AA8000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374E371C545AA8000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F6F1C547109000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374E311C545AA8000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */,
+ 66374E3C1C545AA8000B19D0 /* OpenGLWaveform */,
+ 66374E3B1C545AA8000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374E3B1C545AA8000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E3A1C545AA8000B19D0 /* OpenGLWaveform.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374E3C1C545AA8000B19D0 /* OpenGLWaveform */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E401C545AA8000B19D0 /* AppDelegate.h */,
+ 66374E411C545AA8000B19D0 /* AppDelegate.m */,
+ 66374E431C545AA8000B19D0 /* ViewController.h */,
+ 66374E441C545AA8000B19D0 /* ViewController.m */,
+ 66374E461C545AA8000B19D0 /* Main.storyboard */,
+ 66374E491C545AA8000B19D0 /* Assets.xcassets */,
+ 66374E4B1C545AA8000B19D0 /* LaunchScreen.storyboard */,
+ 66374E4E1C545AA8000B19D0 /* Info.plist */,
+ 66374E3D1C545AA8000B19D0 /* Supporting Files */,
+ );
+ path = OpenGLWaveform;
+ sourceTree = "<group>";
+ };
+ 66374E3D1C545AA8000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E3E1C545AA8000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F311C545B57000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F361C545B57000B19D0 /* EZAudioiOS.framework */,
+ 66374F381C545B57000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374E391C545AA8000B19D0 /* OpenGLWaveform */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374E511C545AA8000B19D0 /* Build configuration list for PBXNativeTarget "OpenGLWaveform" */;
+ buildPhases = (
+ 66374E361C545AA8000B19D0 /* Sources */,
+ 66374E371C545AA8000B19D0 /* Frameworks */,
+ 66374E381C545AA8000B19D0 /* Resources */,
+ 66374F731C547109000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F721C547109000B19D0 /* PBXTargetDependency */,
+ );
+ name = OpenGLWaveform;
+ productName = OpenGLWaveform;
+ productReference = 66374E3A1C545AA8000B19D0 /* OpenGLWaveform.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374E321C545AA8000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374E391C545AA8000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374E351C545AA8000B19D0 /* Build configuration list for PBXProject "OpenGLWaveform" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374E311C545AA8000B19D0;
+ productRefGroup = 66374E3B1C545AA8000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F311C545B57000B19D0 /* Products */;
+ ProjectRef = 66374F301C545B57000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374E391C545AA8000B19D0 /* OpenGLWaveform */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F361C545B57000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F351C545B57000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F381C545B57000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F371C545B57000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374E381C545AA8000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E4D1C545AA8000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374E4A1C545AA8000B19D0 /* Assets.xcassets in Resources */,
+ 66374E481C545AA8000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374E361C545AA8000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E451C545AA8000B19D0 /* ViewController.m in Sources */,
+ 66374E421C545AA8000B19D0 /* AppDelegate.m in Sources */,
+ 66374E3F1C545AA8000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F721C547109000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F711C547109000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374E461C545AA8000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E471C545AA8000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374E4B1C545AA8000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E4C1C545AA8000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374E4F1C545AA8000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374E501C545AA8000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374E521C545AA8000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = OpenGLWaveform/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.OpenGLWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374E531C545AA8000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = OpenGLWaveform/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.OpenGLWaveform;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374E351C545AA8000B19D0 /* Build configuration list for PBXProject "OpenGLWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E4F1C545AA8000B19D0 /* Debug */,
+ 66374E501C545AA8000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374E511C545AA8000B19D0 /* Build configuration list for PBXNativeTarget "OpenGLWaveform" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E521C545AA8000B19D0 /* Debug */,
+ 66374E531C545AA8000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374E321C545AA8000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="Dfm-TQ-VBi">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ <capability name="Constraints to layout margins" minToolsVersion="6.0"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="fii-WA-T2J">
+ <objects>
+ <viewController id="Dfm-TQ-VBi" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="BKy-sG-v4d"/>
+ <viewControllerLayoutGuide type="bottom" id="fEn-ha-AcY"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="3rv-QQ-oim">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="hUJ-9b-aFo" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </view>
+ <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="ApX-pR-EAR">
+ <rect key="frame" x="16" y="520" width="157" height="29"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="157" id="Y1d-so-oPu"/>
+ </constraints>
+ <segments>
+ <segment title="Buffer"/>
+ <segment title="Rolling"/>
+ </segments>
+ <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="changePlotType:" destination="Dfm-TQ-VBi" eventType="valueChanged" id="esQ-yJ-RVc"/>
+ </connections>
+ </segmentedControl>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" buttonType="roundedRect" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="PW8-hj-Rkr">
+ <rect key="frame" x="16" y="556" width="568" height="28"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="tintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <state key="normal" title="Change Microphone Input">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="toggleMicrophonePickerView:" destination="Dfm-TQ-VBi" eventType="touchUpInside" id="9W2-rd-GHH"/>
+ </connections>
+ </button>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="5rt-lN-mkO">
+ <rect key="frame" x="16" y="479" width="51" height="31"/>
+ <color key="onTintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="toggleMicrophone:" destination="Dfm-TQ-VBi" eventType="touchUpInside" id="Eg4-Oa-ZWs"/>
+ </connections>
+ </switch>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Fw3-7I-2Ma">
+ <rect key="frame" x="73" y="487" width="33" height="16"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="0.90000000000000002" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <pickerView contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qBW-je-e9i">
+ <rect key="frame" x="0.0" y="-216" width="600" height="216"/>
+ <color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ </pickerView>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="Fw3-7I-2Ma" firstAttribute="leading" secondItem="5rt-lN-mkO" secondAttribute="trailing" constant="8" symbolic="YES" id="0ws-AU-vj6"/>
+ <constraint firstItem="hUJ-9b-aFo" firstAttribute="top" secondItem="qBW-je-e9i" secondAttribute="bottom" id="AvI-03-JkX"/>
+ <constraint firstItem="5rt-lN-mkO" firstAttribute="leading" secondItem="ApX-pR-EAR" secondAttribute="leading" id="CUF-v9-Be7"/>
+ <constraint firstItem="fEn-ha-AcY" firstAttribute="top" secondItem="PW8-hj-Rkr" secondAttribute="bottom" constant="16" id="ClS-xF-2aS"/>
+ <constraint firstAttribute="trailing" secondItem="PW8-hj-Rkr" secondAttribute="trailing" constant="16" id="Dy8-nf-rVE"/>
+ <constraint firstItem="ApX-pR-EAR" firstAttribute="top" secondItem="5rt-lN-mkO" secondAttribute="bottom" constant="10" id="OqK-6z-0OK"/>
+ <constraint firstItem="ApX-pR-EAR" firstAttribute="leading" secondItem="3rv-QQ-oim" secondAttribute="leading" constant="16" id="SvD-Ts-R5L"/>
+ <constraint firstItem="qBW-je-e9i" firstAttribute="leading" secondItem="3rv-QQ-oim" secondAttribute="leading" id="WpE-39-Sln"/>
+ <constraint firstItem="PW8-hj-Rkr" firstAttribute="top" secondItem="ApX-pR-EAR" secondAttribute="bottom" constant="8" id="cM6-aH-NHJ"/>
+ <constraint firstAttribute="trailing" secondItem="qBW-je-e9i" secondAttribute="trailing" id="jff-vo-uGV"/>
+ <constraint firstItem="5rt-lN-mkO" firstAttribute="leading" secondItem="3rv-QQ-oim" secondAttribute="leading" constant="16" id="lCA-nb-YPQ"/>
+ <constraint firstItem="qBW-je-e9i" firstAttribute="top" secondItem="3rv-QQ-oim" secondAttribute="topMargin" constant="-216" id="mex-96-dqm"/>
+ <constraint firstItem="fEn-ha-AcY" firstAttribute="top" secondItem="hUJ-9b-aFo" secondAttribute="bottom" id="nFp-d8-AgS"/>
+ <constraint firstItem="PW8-hj-Rkr" firstAttribute="leading" secondItem="3rv-QQ-oim" secondAttribute="leading" constant="16" id="qrj-NO-PtL"/>
+ <constraint firstItem="ApX-pR-EAR" firstAttribute="top" secondItem="Fw3-7I-2Ma" secondAttribute="bottom" constant="17" id="tBg-vq-MBS"/>
+ <constraint firstAttribute="trailing" secondItem="hUJ-9b-aFo" secondAttribute="trailing" id="vNj-6P-MiN"/>
+ <constraint firstItem="hUJ-9b-aFo" firstAttribute="leading" secondItem="3rv-QQ-oim" secondAttribute="leading" id="yOc-n1-IeC"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="audioPlot" destination="hUJ-9b-aFo" id="Olm-qY-gvI"/>
+ <outlet property="microphoneInputPickerView" destination="qBW-je-e9i" id="zUb-gh-Uea"/>
+ <outlet property="microphoneInputPickerViewTopConstraint" destination="mex-96-dqm" id="9dV-XY-zy4"/>
+ <outlet property="microphoneInputToggleButton" destination="PW8-hj-Rkr" id="HlF-Ks-4rP"/>
+ <outlet property="microphoneTextLabel" destination="Fw3-7I-2Ma" id="dqh-1k-Thb"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="ygk-w7-KAs" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="574" y="89"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZMicrophoneDelegate, UIPickerViewDataSource, UIPickerViewDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//
+// The microphone component
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//
+// The button at the bottom displaying the currently selected microphone input
+//
+@property (nonatomic, weak) IBOutlet UIButton *microphoneInputToggleButton;
+
+//
+// The microphone input picker view to display the different microphone input sources
+//
+@property (nonatomic, weak) IBOutlet UIPickerView *microphoneInputPickerView;
+
+//
+// The microphone input picker view's top layout constraint (we use this to hide the control)
+//
+@property (nonatomic, weak) IBOutlet NSLayoutConstraint *microphoneInputPickerViewTopConstraint;
+
+//
+// The text label displaying "Microphone On" or "Microphone Off"
+//
+@property (nonatomic, weak) IBOutlet UILabel *microphoneTextLabel;
+
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+- (IBAction)changePlotType:(id)sender;
+
+//
+// Toggles the microphone inputs picker view in and out of display.
+//
+- (IBAction)toggleMicrophonePickerView:(id)sender;
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleMicrophone:(id)sender;
+
+@end
+
--- /dev/null
+//
+// ViewController.m
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController (Interface Extension)
+//------------------------------------------------------------------------------
+
+@interface ViewController ()
+@property (nonatomic, strong) NSArray *inputs;
+@end
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController (Implementation)
+//------------------------------------------------------------------------------
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - View Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Customizing the audio plot's look
+ //
+
+ //
+ // Background color
+ //
+ self.audioPlot.backgroundColor = [UIColor colorWithRed:0.569 green:0.82 blue:0.478 alpha:1.0];
+
+ //
+ // Waveform color
+ //
+ self.audioPlot.color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+
+ //
+ // Plot type
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Create the microphone
+ //
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+
+ //
+ // Set up the microphone input UIPickerView items to select
+ // between different microphone inputs. Here what we're doing behind the hood
+ // is enumerating the available inputs provided by the AVAudioSession.
+ //
+ self.inputs = [EZAudioDevice inputDevices];
+ self.microphoneInputPickerView.dataSource = self;
+ self.microphoneInputPickerView.delegate = self;
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - UIPickerViewDataSource
+//------------------------------------------------------------------------------
+
+- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
+{
+ return 1;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)pickerView:(UIPickerView *)pickerView
+ titleForRow:(NSInteger)row
+ forComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ return device.name;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSAttributedString *)pickerView:(UIPickerView *)pickerView
+ attributedTitleForRow:(NSInteger)row
+ forComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ UIColor *textColor = [device isEqual:self.microphone.device] ? self.audioPlot.backgroundColor : [UIColor blackColor];
+ return [[NSAttributedString alloc] initWithString:device.name
+ attributes:@{ NSForegroundColorAttributeName : textColor }];
+}
+
+//------------------------------------------------------------------------------
+
+- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
+{
+ return self.inputs.count;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
+{
+ EZAudioDevice *device = self.inputs[row];
+ [self.microphone setDevice:device];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegmentIndex];
+ switch (selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ BOOL isOn = [sender isOn];
+ if (!isOn)
+ {
+ [self.microphone stopFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone Off";
+ }
+ else
+ {
+ [self.microphone startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophonePickerView:(id)sender
+{
+ BOOL isHidden = self.microphoneInputPickerViewTopConstraint.constant != 0.0;
+ [self setMicrophonePickerViewHidden:!isHidden];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setMicrophonePickerViewHidden:(BOOL)hidden
+{
+ CGFloat pickerHeight = CGRectGetHeight(self.microphoneInputPickerView.bounds);
+ __weak typeof(self) weakSelf = self;
+ [UIView animateWithDuration:0.55
+ delay:0.0
+ usingSpringWithDamping:0.6
+ initialSpringVelocity:0.5
+ options:(UIViewAnimationOptionBeginFromCurrentState|
+ UIViewAnimationOptionCurveEaseInOut|
+ UIViewAnimationOptionLayoutSubviews)
+ animations:^{
+ weakSelf.microphoneInputPickerViewTopConstraint.constant = hidden ? -pickerHeight : 0.0f;
+ [weakSelf.view layoutSubviews];
+ } completion:nil];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
+//
+// Give the visualization of the current buffer (this is almost exactly the
+// openFrameworks audio input eample)
+//
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+//
+// Give the classic mirrored, rolling waveform look
+//
+-(void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+#pragma mark - EZMicrophoneDelegate
+#warning Thread Safety
+//
+// Note that any callback that provides streamed audio data (like streaming
+// microphone input) happens on a separate audio thread that should not be
+// blocked. When we feed audio data into any of the UI components we need to
+// explicity create a GCD block on the main thread to properly get the UI
+// to work.
+//
+- (void)microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as an array of float buffer arrays. What does that mean?
+ // Because the audio is coming in as a stereo signal the data is split into
+ // a left and right channel. So buffer[0] corresponds to the float* data
+ // for the left channel while buffer[1] corresponds to the float* data
+ // for the right channel.
+ //
+
+ //
+ // See the Thread Safety warning above, but in a nutshell these callbacks
+ // happen on a separate audio thread. We wrap any UI updating in a GCD block
+ // on the main thread to avoid blocking that audio flow.
+ //
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ //
+ // All the audio plot needs is the buffer data (float*) and the size.
+ // Internally the audio plot will handle all the drawing related code,
+ // history management, and freeing its own resources.
+ // Hence, one badass line of code gets you a pretty plot :)
+ //
+ [weakSelf.audioPlot updateBuffer:buffer[0] withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone hasAudioStreamBasicDescription:(AudioStreamBasicDescription)audioStreamBasicDescription
+{
+ //
+ // The AudioStreamBasicDescription of the microphone stream. This is useful
+ // when configuring the EZRecorder or telling another component what
+ // audio format type to expect.
+ //
+ [EZAudioUtilities printASBD:audioStreamBasicDescription];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as a buffer list that can be directly fed into the
+ // EZRecorder or EZOutput. Say whattt...
+ //
+}
+
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device
+{
+ NSLog(@"Microphone changed device: %@", device.name);
+
+ //
+ // Called anytime the microphone's device changes
+ //
+ __weak typeof(self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ NSString *name = device.name;
+ NSString *tapText = @" (Tap To Change)";
+ NSString *microphoneInputToggleButtonText = [NSString stringWithFormat:@"%@%@", device.name, tapText];
+ NSRange rangeOfName = [microphoneInputToggleButtonText rangeOfString:name];
+ NSMutableAttributedString *microphoneInputToggleButtonAttributedText = [[NSMutableAttributedString alloc] initWithString:microphoneInputToggleButtonText];
+ [microphoneInputToggleButtonAttributedText addAttribute:NSFontAttributeName value:[UIFont boldSystemFontOfSize:13.0f] range:rangeOfName];
+ [weakSelf.microphoneInputToggleButton setAttributedTitle:microphoneInputToggleButtonAttributedText forState:UIControlStateNormal];
+
+ //
+ // Reset the device list (a device may have been plugged in/out)
+ //
+ weakSelf.inputs = [EZAudioDevice inputDevices];
+ [weakSelf.microphoneInputPickerView reloadAllComponents];
+ [weakSelf setMicrophonePickerViewHidden:YES];
+ });
+}
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// main.m
+// OpenGLWaveform
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374ECB1C545AFB000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374ECA1C545AFB000B19D0 /* main.m */; };
+ 66374ECE1C545AFB000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374ECD1C545AFB000B19D0 /* AppDelegate.m */; };
+ 66374ED11C545AFB000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374ED01C545AFB000B19D0 /* ViewController.m */; };
+ 66374ED41C545AFB000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374ED21C545AFB000B19D0 /* Main.storyboard */; };
+ 66374ED61C545AFB000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374ED51C545AFB000B19D0 /* Assets.xcassets */; };
+ 66374ED91C545AFB000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374ED71C545AFB000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F981C548287000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F121C545B4B000B19D0 /* EZAudioiOS.framework */; };
+ 66374F991C548287000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F121C545B4B000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F111C545B4B000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F131C545B4B000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F9A1C548287000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F9C1C548287000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F991C548287000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374EC61C545AFB000B19D0 /* PassThrough.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PassThrough.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374ECA1C545AFB000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374ECC1C545AFB000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = AppDelegate.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
+ 66374ECD1C545AFB000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AppDelegate.m; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objc; };
+ 66374ECF1C545AFB000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 66374ED01C545AFB000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ 66374ED31C545AFB000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374ED51C545AFB000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374ED81C545AFB000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374EDA1C545AFB000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374EC31C545AFB000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F981C548287000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374EBD1C545AFB000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */,
+ 66374EC81C545AFB000B19D0 /* PassThrough */,
+ 66374EC71C545AFB000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374EC71C545AFB000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EC61C545AFB000B19D0 /* PassThrough.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374EC81C545AFB000B19D0 /* PassThrough */ = {
+ isa = PBXGroup;
+ children = (
+ 66374ECC1C545AFB000B19D0 /* AppDelegate.h */,
+ 66374ECD1C545AFB000B19D0 /* AppDelegate.m */,
+ 66374ECF1C545AFB000B19D0 /* ViewController.h */,
+ 66374ED01C545AFB000B19D0 /* ViewController.m */,
+ 66374ED21C545AFB000B19D0 /* Main.storyboard */,
+ 66374ED51C545AFB000B19D0 /* Assets.xcassets */,
+ 66374ED71C545AFB000B19D0 /* LaunchScreen.storyboard */,
+ 66374EDA1C545AFB000B19D0 /* Info.plist */,
+ 66374EC91C545AFB000B19D0 /* Supporting Files */,
+ );
+ path = PassThrough;
+ sourceTree = "<group>";
+ };
+ 66374EC91C545AFB000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374ECA1C545AFB000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F0D1C545B4B000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F121C545B4B000B19D0 /* EZAudioiOS.framework */,
+ 66374F141C545B4B000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374EC51C545AFB000B19D0 /* PassThrough */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374EDD1C545AFB000B19D0 /* Build configuration list for PBXNativeTarget "PassThrough" */;
+ buildPhases = (
+ 66374EC21C545AFB000B19D0 /* Sources */,
+ 66374EC31C545AFB000B19D0 /* Frameworks */,
+ 66374EC41C545AFB000B19D0 /* Resources */,
+ 66374F9C1C548287000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F9B1C548287000B19D0 /* PBXTargetDependency */,
+ );
+ name = PassThrough;
+ productName = PassThrough;
+ productReference = 66374EC61C545AFB000B19D0 /* PassThrough.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374EBE1C545AFB000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374EC51C545AFB000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374EC11C545AFB000B19D0 /* Build configuration list for PBXProject "PassThrough" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374EBD1C545AFB000B19D0;
+ productRefGroup = 66374EC71C545AFB000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F0D1C545B4B000B19D0 /* Products */;
+ ProjectRef = 66374F0C1C545B4B000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374EC51C545AFB000B19D0 /* PassThrough */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F121C545B4B000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F111C545B4B000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F141C545B4B000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F131C545B4B000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374EC41C545AFB000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374ED91C545AFB000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374ED61C545AFB000B19D0 /* Assets.xcassets in Resources */,
+ 66374ED41C545AFB000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374EC21C545AFB000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374ED11C545AFB000B19D0 /* ViewController.m in Sources */,
+ 66374ECE1C545AFB000B19D0 /* AppDelegate.m in Sources */,
+ 66374ECB1C545AFB000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F9B1C548287000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F9A1C548287000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374ED21C545AFB000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374ED31C545AFB000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374ED71C545AFB000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374ED81C545AFB000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374EDB1C545AFB000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374EDC1C545AFB000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374EDE1C545AFB000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = PassThrough/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PassThrough;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374EDF1C545AFB000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = PassThrough/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PassThrough;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374EC11C545AFB000B19D0 /* Build configuration list for PBXProject "PassThrough" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374EDB1C545AFB000B19D0 /* Debug */,
+ 66374EDC1C545AFB000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374EDD1C545AFB000B19D0 /* Build configuration list for PBXNativeTarget "PassThrough" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374EDE1C545AFB000B19D0 /* Debug */,
+ 66374EDF1C545AFB000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374EBE1C545AFB000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="yMu-Rx-B90">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="dK8-eo-dF3">
+ <objects>
+ <viewController id="yMu-Rx-B90" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="PcS-SB-ERX"/>
+ <viewControllerLayoutGuide type="bottom" id="N1h-oX-eKR"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Agd-Tm-pvB">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qeb-aE-jHV" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="qeb-aE-jHV" firstAttribute="top" secondItem="Agd-Tm-pvB" secondAttribute="top" id="HLX-cX-Zn7"/>
+ <constraint firstAttribute="trailing" secondItem="qeb-aE-jHV" secondAttribute="trailing" id="Vja-z0-9L4"/>
+ <constraint firstItem="qeb-aE-jHV" firstAttribute="leading" secondItem="Agd-Tm-pvB" secondAttribute="leading" id="gl5-Q3-IZy"/>
+ <constraint firstItem="N1h-oX-eKR" firstAttribute="top" secondItem="qeb-aE-jHV" secondAttribute="bottom" id="wyE-wX-2Bk"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="audioPlot" destination="qeb-aE-jHV" id="cOJ-K5-TY2"/>
+ <outlet property="view" destination="Agd-Tm-pvB" id="urS-J5-1UU"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="08O-tD-0eK" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="120" y="339"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZMicrophoneDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The OpenGL based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// The UILabel used to display whether the microphone is on or off
+//
+@property (nonatomic, weak) IBOutlet UILabel *microphoneTextLabel;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+- (IBAction)changePlotType:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleMicrophone:(id)sender;
+
+@end
+
--- /dev/null
+//
+// ViewController.m
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Status Bar Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Customizing the audio plot's look
+ //
+ self.audioPlot.backgroundColor = [UIColor colorWithRed: 0.569 green: 0.82 blue: 0.478 alpha: 1];
+ self.audioPlot.color = [UIColor colorWithRed: 1.000 green: 1.000 blue: 1.000 alpha: 1];
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Start the microphone
+ //
+ [EZMicrophone sharedMicrophone].delegate = self;
+ [[EZMicrophone sharedMicrophone] startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+
+ //
+ // Use the microphone as the EZOutputDataSource
+ //
+ [[EZMicrophone sharedMicrophone] setOutput:[EZOutput sharedOutput]];
+
+ //
+ // Make sure we override the output to the speaker
+ //
+ [session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:NULL];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Start the EZOutput
+ //
+ [[EZOutput sharedOutput] startPlayback];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegmentIndex];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ if( ![(UISwitch*)sender isOn] )
+ {
+ [[EZMicrophone sharedMicrophone] stopFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone Off";
+ }
+ else
+ {
+ [[EZMicrophone sharedMicrophone] startFetchingAudio];
+ self.microphoneTextLabel.text = @"Microphone On";
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+//
+// Give the visualization of the current buffer (this is almost exactly the
+// openFrameworks audio input example)
+//
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+//
+// Give the classic mirrored, rolling waveform look
+//
+- (void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+-(void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+@end
--- /dev/null
+//
+// main.m
+// PassThrough
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374E621C545AC6000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E611C545AC6000B19D0 /* main.m */; };
+ 66374E651C545AC6000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E641C545AC6000B19D0 /* AppDelegate.m */; };
+ 66374E681C545AC6000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E671C545AC6000B19D0 /* ViewController.m */; };
+ 66374E6B1C545AC6000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E691C545AC6000B19D0 /* Main.storyboard */; };
+ 66374E6D1C545AC6000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374E6C1C545AC6000B19D0 /* Assets.xcassets */; };
+ 66374E701C545AC6000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E6E1C545AC6000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F761C5475B1000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F2D1C545B55000B19D0 /* EZAudioiOS.framework */; };
+ 66374F771C5475B1000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F2D1C545B55000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 66374F7C1C5475DF000B19D0 /* simple-drum-beat.wav in Resources */ = {isa = PBXBuildFile; fileRef = 66374F7B1C5475DF000B19D0 /* simple-drum-beat.wav */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F2C1C545B55000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F2E1C545B55000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F781C5475B1000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F7A1C5475B1000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F771C5475B1000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374E5D1C545AC6000B19D0 /* PlayFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = PlayFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374E611C545AC6000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374E631C545AC6000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374E641C545AC6000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374E661C545AC6000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 66374E671C545AC6000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ 66374E6A1C545AC6000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374E6C1C545AC6000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374E6F1C545AC6000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374E711C545AC6000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+ 66374F7B1C5475DF000B19D0 /* simple-drum-beat.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "simple-drum-beat.wav"; path = "../../simple-drum-beat.wav"; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374E5A1C545AC6000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F761C5475B1000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374E541C545AC6000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */,
+ 66374E5F1C545AC6000B19D0 /* PlayFile */,
+ 66374E5E1C545AC6000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374E5E1C545AC6000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E5D1C545AC6000B19D0 /* PlayFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374E5F1C545AC6000B19D0 /* PlayFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F7B1C5475DF000B19D0 /* simple-drum-beat.wav */,
+ 66374E631C545AC6000B19D0 /* AppDelegate.h */,
+ 66374E641C545AC6000B19D0 /* AppDelegate.m */,
+ 66374E661C545AC6000B19D0 /* ViewController.h */,
+ 66374E671C545AC6000B19D0 /* ViewController.m */,
+ 66374E691C545AC6000B19D0 /* Main.storyboard */,
+ 66374E6C1C545AC6000B19D0 /* Assets.xcassets */,
+ 66374E6E1C545AC6000B19D0 /* LaunchScreen.storyboard */,
+ 66374E711C545AC6000B19D0 /* Info.plist */,
+ 66374E601C545AC6000B19D0 /* Supporting Files */,
+ );
+ path = PlayFile;
+ sourceTree = "<group>";
+ };
+ 66374E601C545AC6000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E611C545AC6000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F281C545B55000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F2D1C545B55000B19D0 /* EZAudioiOS.framework */,
+ 66374F2F1C545B55000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374E5C1C545AC6000B19D0 /* PlayFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374E741C545AC6000B19D0 /* Build configuration list for PBXNativeTarget "PlayFile" */;
+ buildPhases = (
+ 66374E591C545AC6000B19D0 /* Sources */,
+ 66374E5A1C545AC6000B19D0 /* Frameworks */,
+ 66374E5B1C545AC6000B19D0 /* Resources */,
+ 66374F7A1C5475B1000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F791C5475B1000B19D0 /* PBXTargetDependency */,
+ );
+ name = PlayFile;
+ productName = PlayFile;
+ productReference = 66374E5D1C545AC6000B19D0 /* PlayFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374E551C545AC6000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374E5C1C545AC6000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374E581C545AC6000B19D0 /* Build configuration list for PBXProject "PlayFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374E541C545AC6000B19D0;
+ productRefGroup = 66374E5E1C545AC6000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F281C545B55000B19D0 /* Products */;
+ ProjectRef = 66374F271C545B55000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374E5C1C545AC6000B19D0 /* PlayFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F2D1C545B55000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F2C1C545B55000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F2F1C545B55000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F2E1C545B55000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374E5B1C545AC6000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F7C1C5475DF000B19D0 /* simple-drum-beat.wav in Resources */,
+ 66374E701C545AC6000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374E6D1C545AC6000B19D0 /* Assets.xcassets in Resources */,
+ 66374E6B1C545AC6000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374E591C545AC6000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E681C545AC6000B19D0 /* ViewController.m in Sources */,
+ 66374E651C545AC6000B19D0 /* AppDelegate.m in Sources */,
+ 66374E621C545AC6000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F791C5475B1000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F781C5475B1000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374E691C545AC6000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E6A1C545AC6000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374E6E1C545AC6000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E6F1C545AC6000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374E721C545AC6000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374E731C545AC6000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374E751C545AC6000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = PlayFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PlayFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374E761C545AC6000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = PlayFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.PlayFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374E581C545AC6000B19D0 /* Build configuration list for PBXProject "PlayFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E721C545AC6000B19D0 /* Debug */,
+ 66374E731C545AC6000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374E741C545AC6000B19D0 /* Build configuration list for PBXNativeTarget "PlayFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E751C545AC6000B19D0 /* Debug */,
+ 66374E761C545AC6000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374E551C545AC6000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="NGN-E9-HFS">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="0M4-MQ-OpR">
+ <objects>
+ <viewController id="NGN-E9-HFS" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="idj-Ol-hht"/>
+ <viewControllerLayoutGuide type="bottom" id="FcJ-BE-Rsd"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="H3q-tP-fjD">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="qW2-32-v6e" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="09y-q5-utV">
+ <rect key="frame" x="0.0" y="396" width="600" height="204"/>
+ <subviews>
+ <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="cXp-Mm-SWR">
+ <rect key="frame" x="120.5" y="9" width="464.5" height="31"/>
+ <color key="tintColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="changeVolume:" destination="NGN-E9-HFS" eventType="valueChanged" id="PW9-t2-4Qw"/>
+ </connections>
+ </slider>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Volume:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Wq-R9-rY1">
+ <rect key="frame" x="18" y="15" width="51.5" height="16"/>
+ <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/>
+ <color key="textColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="204" id="99C-f0-2FZ"/>
+ <constraint firstItem="0Wq-R9-rY1" firstAttribute="leading" secondItem="09y-q5-utV" secondAttribute="leading" constant="18" id="9VV-cU-5I3"/>
+ <constraint firstItem="cXp-Mm-SWR" firstAttribute="top" secondItem="09y-q5-utV" secondAttribute="top" constant="9" id="FO0-I6-bb8"/>
+ <constraint firstItem="cXp-Mm-SWR" firstAttribute="leading" secondItem="0Wq-R9-rY1" secondAttribute="trailing" constant="53" id="MwQ-Uy-AOv"/>
+ <constraint firstItem="0Wq-R9-rY1" firstAttribute="top" secondItem="09y-q5-utV" secondAttribute="top" constant="15" id="wWD-cJ-Er6"/>
+ <constraint firstAttribute="trailing" secondItem="cXp-Mm-SWR" secondAttribute="trailing" constant="17" id="yOh-bq-WXY"/>
+ </constraints>
+ </view>
+ <segmentedControl opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="top" segmentControlStyle="plain" selectedSegmentIndex="0" translatesAutoresizingMaskIntoConstraints="NO" id="AHP-5X-Xnr">
+ <rect key="frame" x="469" y="554" width="113" height="29"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="113" id="DnJ-fB-6EV"/>
+ <constraint firstAttribute="height" constant="28" id="pMp-nL-6Gz"/>
+ </constraints>
+ <segments>
+ <segment title="Buffer"/>
+ <segment title="Rolling"/>
+ </segments>
+ <color key="tintColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="changePlotType:" destination="NGN-E9-HFS" eventType="valueChanged" id="XKw-jc-1Er"/>
+ </connections>
+ </segmentedControl>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dNk-HE-1RD">
+ <rect key="frame" x="18" y="522" width="564" height="21"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="21" id="E0W-Ux-K5w"/>
+ </constraints>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="TME-SX-EGZ">
+ <rect key="frame" x="2" y="552" width="59" height="30"/>
+ <constraints>
+ <constraint firstAttribute="width" constant="59" id="O24-kP-6ef"/>
+ <constraint firstAttribute="height" constant="30" id="epj-68-tDA"/>
+ </constraints>
+ <fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="13"/>
+ <color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <state key="normal" title="Play">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="play:" destination="NGN-E9-HFS" eventType="touchUpInside" id="Vno-1v-Tjh"/>
+ </connections>
+ </button>
+ <slider opaque="NO" multipleTouchEnabled="YES" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="0.5" minValue="0.0" maxValue="1" translatesAutoresizingMaskIntoConstraints="NO" id="ekw-C0-4BU">
+ <rect key="frame" x="116.5" y="483" width="467.5" height="31"/>
+ <color key="tintColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="seekToFrame:" destination="NGN-E9-HFS" eventType="valueChanged" id="bWR-qS-iG7"/>
+ </connections>
+ </slider>
+ <slider opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" value="128" minValue="128" maxValue="1024" translatesAutoresizingMaskIntoConstraints="NO" id="6d9-qs-Efp">
+ <rect key="frame" x="118.5" y="444" width="465.5" height="31"/>
+ <color key="tintColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="changeRollingHistoryLength:" destination="NGN-E9-HFS" eventType="valueChanged" id="Lrh-3d-rig"/>
+ </connections>
+ </slider>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Rolling Length:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Wwu-nf-vdS">
+ <rect key="frame" x="17" y="451" width="94.5" height="16"/>
+ <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/>
+ <color key="textColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Position:" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sZp-Tf-eyF">
+ <rect key="frame" x="17" y="490" width="55.5" height="16"/>
+ <fontDescription key="fontDescription" type="system" weight="semibold" pointSize="13"/>
+ <color key="textColor" red="0.93725490199999995" green="0.93725490199999995" blue="0.95686274510000002" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="sZp-Tf-eyF" firstAttribute="top" secondItem="Wwu-nf-vdS" secondAttribute="bottom" constant="23" id="56e-aM-GOq"/>
+ <constraint firstItem="TME-SX-EGZ" firstAttribute="top" secondItem="dNk-HE-1RD" secondAttribute="bottom" constant="9" id="7PN-zo-U8T"/>
+ <constraint firstItem="6d9-qs-Efp" firstAttribute="leading" secondItem="Wwu-nf-vdS" secondAttribute="trailing" constant="9" id="E8w-1g-J7b"/>
+ <constraint firstItem="09y-q5-utV" firstAttribute="leading" secondItem="qW2-32-v6e" secondAttribute="leading" id="Fjw-ni-pVh"/>
+ <constraint firstAttribute="bottom" secondItem="09y-q5-utV" secondAttribute="bottom" id="Qac-IW-D5W"/>
+ <constraint firstItem="sZp-Tf-eyF" firstAttribute="leading" secondItem="qW2-32-v6e" secondAttribute="leading" constant="17" id="R7p-18-4R1"/>
+ <constraint firstAttribute="bottom" secondItem="AHP-5X-Xnr" secondAttribute="bottom" constant="18" id="RHf-0z-KCG"/>
+ <constraint firstItem="TME-SX-EGZ" firstAttribute="leading" secondItem="qW2-32-v6e" secondAttribute="leading" constant="2" id="Sn1-jz-i5I"/>
+ <constraint firstAttribute="trailing" secondItem="09y-q5-utV" secondAttribute="trailing" id="T0m-Ce-Kyf"/>
+ <constraint firstItem="ekw-C0-4BU" firstAttribute="leading" secondItem="sZp-Tf-eyF" secondAttribute="trailing" constant="46" id="WD9-Au-pDE"/>
+ <constraint firstAttribute="trailing" secondItem="dNk-HE-1RD" secondAttribute="trailing" constant="18" id="YyQ-6c-cOJ"/>
+ <constraint firstItem="Wwu-nf-vdS" firstAttribute="leading" secondItem="qW2-32-v6e" secondAttribute="leading" constant="17" id="Zrz-dw-SCA"/>
+ <constraint firstItem="ekw-C0-4BU" firstAttribute="top" secondItem="6d9-qs-Efp" secondAttribute="bottom" constant="9" id="aMP-0b-aFz"/>
+ <constraint firstItem="dNk-HE-1RD" firstAttribute="leading" secondItem="qW2-32-v6e" secondAttribute="leading" constant="18" id="dK1-XK-GyV"/>
+ <constraint firstAttribute="trailing" secondItem="6d9-qs-Efp" secondAttribute="trailing" constant="18" id="gba-s8-Km1"/>
+ <constraint firstItem="dNk-HE-1RD" firstAttribute="top" secondItem="sZp-Tf-eyF" secondAttribute="bottom" constant="16" id="ksv-4j-Wzs"/>
+ <constraint firstAttribute="trailing" secondItem="ekw-C0-4BU" secondAttribute="trailing" constant="18" id="nrj-FA-tqX"/>
+ <constraint firstAttribute="bottom" secondItem="TME-SX-EGZ" secondAttribute="bottom" constant="18" id="oQU-3I-rtM"/>
+ <constraint firstAttribute="trailing" secondItem="AHP-5X-Xnr" secondAttribute="trailing" constant="18" id="s0p-QQ-Lbf"/>
+ <constraint firstItem="dNk-HE-1RD" firstAttribute="top" secondItem="ekw-C0-4BU" secondAttribute="bottom" constant="9" id="zcX-C8-6PC"/>
+ </constraints>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="qW2-32-v6e" firstAttribute="leading" secondItem="H3q-tP-fjD" secondAttribute="leading" id="19f-O1-fQ3"/>
+ <constraint firstItem="FcJ-BE-Rsd" firstAttribute="top" secondItem="qW2-32-v6e" secondAttribute="bottom" id="TxB-Ik-HUK"/>
+ <constraint firstAttribute="trailing" secondItem="qW2-32-v6e" secondAttribute="trailing" id="TyB-6K-mrc"/>
+ <constraint firstItem="qW2-32-v6e" firstAttribute="top" secondItem="H3q-tP-fjD" secondAttribute="top" id="fst-JE-qFg"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="audioPlot" destination="qW2-32-v6e" id="Hzf-jb-fAz"/>
+ <outlet property="filePathLabel" destination="dNk-HE-1RD" id="zMW-oT-9Ce"/>
+ <outlet property="positionSlider" destination="ekw-C0-4BU" id="uT7-k2-Op7"/>
+ <outlet property="rollingHistorySlider" destination="6d9-qs-Efp" id="8d3-AE-QLg"/>
+ <outlet property="view" destination="H3q-tP-fjD" id="FoQ-d6-22j"/>
+ <outlet property="volumeSlider" destination="cXp-Mm-SWR" id="96Z-wz-ag1"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="NQv-6P-np1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="455" y="71"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// Here's the default audio file included with the example
+//
+#define kAudioFileDefault [[NSBundle mainBundle] pathForResource:@"simple-drum-beat" ofType:@"wav"]
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZAudioPlayerDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// An EZAudioFile that will be used to load the audio file at the file path specified
+//
+@property (nonatomic, strong) EZAudioFile *audioFile;
+
+//------------------------------------------------------------------------------
+
+//
+// An EZAudioPlayer that will be used for playback
+//
+@property (nonatomic, strong) EZAudioPlayer *player;
+
+//------------------------------------------------------------------------------
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *audioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// A label to display the current file path with the waveform shown
+//
+@property (nonatomic, weak) IBOutlet UILabel *filePathLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// A slider to indicate the current frame position in the audio file
+//
+@property (nonatomic, weak) IBOutlet UISlider *positionSlider;
+
+//------------------------------------------------------------------------------
+
+//
+// A slider to indicate the rolling history length of the audio plot.
+//
+@property (nonatomic, weak) IBOutlet UISlider *rollingHistorySlider;
+
+//------------------------------------------------------------------------------
+
+//
+// A slider to indicate the volume on the audio player
+//
+@property (nonatomic, weak) IBOutlet UISlider *volumeSlider;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Switches the plot drawing type between a buffer plot (visualizes the current
+// stream of audio data from the update function) or a rolling plot (visualizes
+// the audio data over time, this is the classic waveform look)
+//
+- (IBAction)changePlotType:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Changes the length of the rolling history of the audio plot.
+//
+- (IBAction)changeRollingHistoryLength:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Changes the volume of the audio player.
+//
+- (IBAction)changeVolume:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Begins playback if a file is loaded. Pauses if the file is already playing.
+//
+- (IBAction)play:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Seeks to a specific frame in the audio file.
+//
+- (IBAction)seekToFrame:(id)sender;
+
+@end
\ No newline at end of file
--- /dev/null
+//
+// ViewController.m
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Status Bar Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayback error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Customizing the audio plot's look
+ //
+ self.audioPlot.backgroundColor = [UIColor colorWithRed: 0.816 green: 0.349 blue: 0.255 alpha: 1];
+ self.audioPlot.color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+
+ NSLog(@"outputs: %@", [EZAudioDevice outputDevices]);
+
+ //
+ // Create the audio player
+ //
+ self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
+ self.player.shouldLoop = YES;
+
+ //
+ // Override the output to the speaker
+ //
+ [session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
+ if (error)
+ {
+ NSLog(@"Error overriding output to the speaker: %@", error.localizedDescription);
+ }
+
+ //
+ // Customize UI components
+ //
+ self.rollingHistorySlider.value = (float)[self.audioPlot rollingHistoryLength];
+
+ //
+ // Listen for EZAudioPlayer notifications
+ //
+ [self setupNotifications];
+
+ /*
+ Try opening the sample file
+ */
+ [self openFileWithFilePathURL:[NSURL fileURLWithPath:kAudioFileDefault]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+- (void)setupNotifications
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangeAudioFile:)
+ name:EZAudioPlayerDidChangeAudioFileNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangeOutputDevice:)
+ name:EZAudioPlayerDidChangeOutputDeviceNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(audioPlayerDidChangePlayState:)
+ name:EZAudioPlayerDidChangePlayStateNotification
+ object:self.player];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangeAudioFile:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player changed audio file: %@", [player audioFile]);
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangeOutputDevice:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player changed output device: %@", [player device]);
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayerDidChangePlayState:(NSNotification *)notification
+{
+ EZAudioPlayer *player = [notification object];
+ NSLog(@"Player change play state, isPlaying: %i", [player isPlaying]);
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)changePlotType:(id)sender
+{
+ NSInteger selectedSegment = [sender selectedSegmentIndex];
+ switch(selectedSegment)
+ {
+ case 0:
+ [self drawBufferPlot];
+ break;
+ case 1:
+ [self drawRollingPlot];
+ break;
+ default:
+ break;
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changeRollingHistoryLength:(id)sender
+{
+ float value = [(UISlider *)sender value];
+ [self.audioPlot setRollingHistoryLength:(int)value];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)changeVolume:(id)sender
+{
+ float value = [(UISlider *)sender value];
+ [self.player setVolume:value];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)openFileWithFilePathURL:(NSURL *)filePathURL
+{
+ //
+ // Create the EZAudioPlayer
+ //
+ self.audioFile = [EZAudioFile audioFileWithURL:filePathURL];
+
+ //
+ // Update the UI
+ //
+ self.filePathLabel.text = filePathURL.lastPathComponent;
+ self.positionSlider.maximumValue = (float)self.audioFile.totalFrames;
+ self.volumeSlider.value = [self.player volume];
+
+ //
+ // Plot the whole waveform
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+ __weak typeof (self) weakSelf = self;
+ [self.audioFile getWaveformDataWithCompletionBlock:^(float **waveformData,
+ int length)
+ {
+ [weakSelf.audioPlot updateBuffer:waveformData[0]
+ withBufferSize:length];
+ }];
+
+ //
+ // Play the audio file
+ //
+ [self.player setAudioFile:self.audioFile];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)play:(id)sender
+{
+ if ([self.player isPlaying])
+ {
+ [self.player pause];
+ }
+ else
+ {
+ if (self.audioPlot.shouldMirror && (self.audioPlot.plotType == EZPlotTypeBuffer))
+ {
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+ }
+ [self.player play];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)seekToFrame:(id)sender
+{
+ [self.player seekToFrame:(SInt64)[(UISlider *)sender value]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayerDelegate
+//------------------------------------------------------------------------------
+
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!weakSelf.positionSlider.touchInside)
+ {
+ weakSelf.positionSlider.value = (float)framePosition;
+ }
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
+/*
+ Give the visualization of the current buffer (this is almost exactly the openFrameworks audio input eample)
+ */
+- (void)drawBufferPlot
+{
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldMirror = NO;
+ self.audioPlot.shouldFill = NO;
+}
+
+//------------------------------------------------------------------------------
+
+/*
+ Give the classic mirrored, rolling waveform look
+ */
+- (void)drawRollingPlot
+{
+ self.audioPlot.plotType = EZPlotTypeRolling;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+}
+
+@end
--- /dev/null
+//
+// main.m
+// PlayFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374E851C545AD8000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E841C545AD8000B19D0 /* main.m */; };
+ 66374E881C545AD8000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E871C545AD8000B19D0 /* AppDelegate.m */; };
+ 66374E8B1C545AD8000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374E8A1C545AD8000B19D0 /* ViewController.m */; };
+ 66374E8E1C545AD8000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E8C1C545AD8000B19D0 /* Main.storyboard */; };
+ 66374E901C545AD8000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374E8F1C545AD8000B19D0 /* Assets.xcassets */; };
+ 66374E931C545AD8000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374E911C545AD8000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F7F1C547A65000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F241C545B52000B19D0 /* EZAudioiOS.framework */; };
+ 66374F801C547A65000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F241C545B52000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F231C545B52000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F251C545B52000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F811C547A65000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F831C547A65000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F801C547A65000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374E801C545AD8000B19D0 /* RecordFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RecordFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374E841C545AD8000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374E861C545AD8000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374E871C545AD8000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374E891C545AD8000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 66374E8A1C545AD8000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ 66374E8D1C545AD8000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374E8F1C545AD8000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374E921C545AD8000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374E941C545AD8000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374E7D1C545AD8000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F7F1C547A65000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374E771C545AD8000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */,
+ 66374E821C545AD8000B19D0 /* RecordFile */,
+ 66374E811C545AD8000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374E811C545AD8000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E801C545AD8000B19D0 /* RecordFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374E821C545AD8000B19D0 /* RecordFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E861C545AD8000B19D0 /* AppDelegate.h */,
+ 66374E871C545AD8000B19D0 /* AppDelegate.m */,
+ 66374E891C545AD8000B19D0 /* ViewController.h */,
+ 66374E8A1C545AD8000B19D0 /* ViewController.m */,
+ 66374E8C1C545AD8000B19D0 /* Main.storyboard */,
+ 66374E8F1C545AD8000B19D0 /* Assets.xcassets */,
+ 66374E911C545AD8000B19D0 /* LaunchScreen.storyboard */,
+ 66374E941C545AD8000B19D0 /* Info.plist */,
+ 66374E831C545AD8000B19D0 /* Supporting Files */,
+ );
+ path = RecordFile;
+ sourceTree = "<group>";
+ };
+ 66374E831C545AD8000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374E841C545AD8000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F1F1C545B52000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F241C545B52000B19D0 /* EZAudioiOS.framework */,
+ 66374F261C545B52000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374E7F1C545AD8000B19D0 /* RecordFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374E971C545AD8000B19D0 /* Build configuration list for PBXNativeTarget "RecordFile" */;
+ buildPhases = (
+ 66374E7C1C545AD8000B19D0 /* Sources */,
+ 66374E7D1C545AD8000B19D0 /* Frameworks */,
+ 66374E7E1C545AD8000B19D0 /* Resources */,
+ 66374F831C547A65000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F821C547A65000B19D0 /* PBXTargetDependency */,
+ );
+ name = RecordFile;
+ productName = RecordFile;
+ productReference = 66374E801C545AD8000B19D0 /* RecordFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374E781C545AD8000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374E7F1C545AD8000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374E7B1C545AD8000B19D0 /* Build configuration list for PBXProject "RecordFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374E771C545AD8000B19D0;
+ productRefGroup = 66374E811C545AD8000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F1F1C545B52000B19D0 /* Products */;
+ ProjectRef = 66374F1E1C545B52000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374E7F1C545AD8000B19D0 /* RecordFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F241C545B52000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F231C545B52000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F261C545B52000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F251C545B52000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374E7E1C545AD8000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E931C545AD8000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374E901C545AD8000B19D0 /* Assets.xcassets in Resources */,
+ 66374E8E1C545AD8000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374E7C1C545AD8000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374E8B1C545AD8000B19D0 /* ViewController.m in Sources */,
+ 66374E881C545AD8000B19D0 /* AppDelegate.m in Sources */,
+ 66374E851C545AD8000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F821C547A65000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F811C547A65000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374E8C1C545AD8000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E8D1C545AD8000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374E911C545AD8000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374E921C545AD8000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374E951C545AD8000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374E961C545AD8000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374E981C545AD8000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = RecordFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.RecordFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374E991C545AD8000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = RecordFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.RecordFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374E7B1C545AD8000B19D0 /* Build configuration list for PBXProject "RecordFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E951C545AD8000B19D0 /* Debug */,
+ 66374E961C545AD8000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374E971C545AD8000B19D0 /* Build configuration list for PBXNativeTarget "RecordFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374E981C545AD8000B19D0 /* Debug */,
+ 66374E991C545AD8000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374E781C545AD8000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="wdu-Wg-DSd">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="uUc-CG-UjL">
+ <objects>
+ <viewController id="wdu-Wg-DSd" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="mgJ-SG-r2o"/>
+ <viewControllerLayoutGuide type="bottom" id="YyZ-PE-YCI"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="HYj-bO-XbX">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="XX6-wN-hGZ" customClass="EZAudioPlotGL">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="1fN-bC-YM5">
+ <rect key="frame" x="0.0" y="455" width="600" height="145"/>
+ <subviews>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" on="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Apn-uY-X7f">
+ <rect key="frame" x="18" y="57" width="51" height="31"/>
+ <color key="onTintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <connections>
+ <action selector="toggleMicrophone:" destination="wdu-Wg-DSd" eventType="valueChanged" id="crc-kZ-6Pb"/>
+ </connections>
+ </switch>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Microphone On" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q9r-fK-cYo">
+ <rect key="frame" x="85" y="65" width="497" height="16"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <switch opaque="NO" contentMode="scaleToFill" horizontalHuggingPriority="750" verticalHuggingPriority="750" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="CPK-nJ-zaV">
+ <rect key="frame" x="18" y="96" width="51" height="31"/>
+ <color key="onTintColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <connections>
+ <action selector="toggleRecording:" destination="wdu-Wg-DSd" eventType="valueChanged" id="u0k-Vx-P4D"/>
+ </connections>
+ </switch>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Recording On" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="9Tp-8O-bIO">
+ <rect key="frame" x="85" y="104" width="497" height="16"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <label opaque="NO" clipsSubviews="YES" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Not Playing" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Q1Q-qS-AMX">
+ <rect key="frame" x="85" y="26" width="497" height="16"/>
+ <fontDescription key="fontDescription" type="system" pointSize="13"/>
+ <color key="textColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" showsTouchWhenHighlighted="YES" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="hf0-qJ-ees">
+ <rect key="frame" x="13" y="19" width="59" height="30"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="30" id="9Ap-W6-3aW"/>
+ <constraint firstAttribute="width" constant="59" id="hm5-tC-VAO"/>
+ </constraints>
+ <fontDescription key="fontDescription" name="HelveticaNeue-Bold" family="Helvetica Neue" pointSize="13"/>
+ <color key="tintColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <state key="normal" title="Play">
+ <color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
+ </state>
+ <connections>
+ <action selector="playFile:" destination="wdu-Wg-DSd" eventType="touchUpInside" id="IMj-8X-bXP"/>
+ </connections>
+ </button>
+ </subviews>
+ <color key="backgroundColor" red="0.0" green="0.0" blue="0.0" alpha="0.69999999999999996" colorSpace="custom" customColorSpace="sRGB"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="145" id="Ax0-TM-dlI"/>
+ <constraint firstAttribute="trailing" secondItem="Q1Q-qS-AMX" secondAttribute="trailing" constant="18" id="V3k-mz-nDi"/>
+ <constraint firstItem="hf0-qJ-ees" firstAttribute="top" secondItem="1fN-bC-YM5" secondAttribute="top" constant="19" id="f8Y-uv-7H6"/>
+ <constraint firstItem="Q1Q-qS-AMX" firstAttribute="leading" secondItem="hf0-qJ-ees" secondAttribute="trailing" constant="13" id="iCH-1t-P6g"/>
+ <constraint firstItem="hf0-qJ-ees" firstAttribute="leading" secondItem="1fN-bC-YM5" secondAttribute="leading" constant="13" id="tpQ-13-ENY"/>
+ <constraint firstItem="Q1Q-qS-AMX" firstAttribute="top" secondItem="1fN-bC-YM5" secondAttribute="top" constant="26" id="yfq-Pf-lck"/>
+ </constraints>
+ </view>
+ <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="00:00" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="GD2-44-PHg">
+ <rect key="frame" x="18" y="18" width="86.5" height="38.5"/>
+ <fontDescription key="fontDescription" type="system" weight="light" pointSize="32"/>
+ <color key="textColor" red="1" green="1" blue="1" alpha="1" colorSpace="calibratedRGB"/>
+ <nil key="highlightedColor"/>
+ </label>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Jal-9o-GYe" customClass="EZAudioPlot">
+ <rect key="frame" x="113.5" y="18" width="468.5" height="39"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstAttribute="height" constant="39" id="6v8-Pe-CIQ"/>
+ </constraints>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="GD2-44-PHg" firstAttribute="top" secondItem="XX6-wN-hGZ" secondAttribute="top" constant="18" id="IAZ-Mp-sB7"/>
+ <constraint firstAttribute="trailing" secondItem="1fN-bC-YM5" secondAttribute="trailing" id="Qna-e1-gDP"/>
+ <constraint firstItem="GD2-44-PHg" firstAttribute="leading" secondItem="XX6-wN-hGZ" secondAttribute="leading" constant="18" id="XBF-UG-bbp"/>
+ <constraint firstItem="1fN-bC-YM5" firstAttribute="leading" secondItem="XX6-wN-hGZ" secondAttribute="leading" id="Zkk-sD-S7k"/>
+ <constraint firstItem="Jal-9o-GYe" firstAttribute="leading" secondItem="GD2-44-PHg" secondAttribute="trailing" constant="9" id="aFa-gD-UAO"/>
+ <constraint firstItem="Jal-9o-GYe" firstAttribute="top" secondItem="XX6-wN-hGZ" secondAttribute="top" constant="18" id="eHG-3g-1FI"/>
+ <constraint firstAttribute="bottom" secondItem="1fN-bC-YM5" secondAttribute="bottom" id="plz-Cs-1YR"/>
+ <constraint firstAttribute="trailing" secondItem="Jal-9o-GYe" secondAttribute="trailing" constant="18" id="ujD-4K-fsm"/>
+ </constraints>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="XX6-wN-hGZ" firstAttribute="top" secondItem="HYj-bO-XbX" secondAttribute="top" id="88U-1T-ssS"/>
+ <constraint firstItem="YyZ-PE-YCI" firstAttribute="top" secondItem="XX6-wN-hGZ" secondAttribute="bottom" id="MOD-FZ-D2L"/>
+ <constraint firstAttribute="trailing" secondItem="XX6-wN-hGZ" secondAttribute="trailing" id="a6n-ne-t6U"/>
+ <constraint firstItem="XX6-wN-hGZ" firstAttribute="leading" secondItem="HYj-bO-XbX" secondAttribute="leading" id="s2T-Tz-Vx9"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="currentTimeLabel" destination="GD2-44-PHg" id="Tln-Gm-aeP"/>
+ <outlet property="microphoneStateLabel" destination="Q9r-fK-cYo" id="Xdc-BN-P0h"/>
+ <outlet property="microphoneSwitch" destination="Apn-uY-X7f" id="Aed-uk-OHQ"/>
+ <outlet property="playButton" destination="hf0-qJ-ees" id="1X6-E9-vkg"/>
+ <outlet property="playingAudioPlot" destination="Jal-9o-GYe" id="MR2-hh-CC1"/>
+ <outlet property="playingStateLabel" destination="Q1Q-qS-AMX" id="gmg-fe-olH"/>
+ <outlet property="recordSwitch" destination="CPK-nJ-zaV" id="WO9-xi-oKB"/>
+ <outlet property="recordingAudioPlot" destination="XX6-wN-hGZ" id="ddY-8j-8L7"/>
+ <outlet property="recordingStateLabel" destination="9Tp-8O-bIO" id="ZXR-4b-NKf"/>
+ <outlet property="view" destination="HYj-bO-XbX" id="rKd-WN-eQb"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="meB-aB-hDi" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="564" y="61"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// By default this will record a file to the application's documents directory
+// (within the application's sandbox)
+//
+#define kAudioFilePath @"test.m4a"
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController <EZAudioPlayerDelegate, EZMicrophoneDelegate, EZRecorderDelegate>
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the current time for recording/playback in the top
+// left
+//
+@property (nonatomic, weak) IBOutlet UILabel *currentTimeLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// Use a OpenGL based plot to visualize the data coming in
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlotGL *recordingAudioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// A flag indicating whether we are recording or not
+//
+@property (nonatomic, assign) BOOL isRecording;
+
+//------------------------------------------------------------------------------
+
+//
+// The microphone component
+//
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+//------------------------------------------------------------------------------
+
+//
+// The switch used to toggle the microphone on/off
+//
+@property (nonatomic, weak) IBOutlet UISwitch *microphoneSwitch;
+
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the microphone's play state
+//
+@property (nonatomic, weak) IBOutlet UILabel *microphoneStateLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// The audio player that will play the recorded file
+//
+@property (nonatomic, strong) EZAudioPlayer *player;
+
+//------------------------------------------------------------------------------
+
+//
+// The recorder component
+//
+@property (nonatomic, strong) EZRecorder *recorder;
+
+//------------------------------------------------------------------------------
+
+//
+// The second audio plot used on the top right to display the current playing audio
+//
+@property (nonatomic, weak) IBOutlet EZAudioPlot *playingAudioPlot;
+
+//------------------------------------------------------------------------------
+
+//
+// The button the user taps to play the recorded audio file
+//
+@property (nonatomic, weak) IBOutlet UIButton *playButton;
+
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the audio player play state
+//
+@property (nonatomic, weak) IBOutlet UILabel *playingStateLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// The label used to display the recording play state
+//
+@property (nonatomic, weak) IBOutlet UILabel *recordingStateLabel;
+
+//------------------------------------------------------------------------------
+
+//
+// The switch used to toggle the recording on/off
+//
+@property (nonatomic, weak) IBOutlet UISwitch *recordSwitch;
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+//
+// Stops the recorder and starts playing whatever has been recorded.
+//
+- (IBAction)playFile:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the microphone on and off. When the microphone is on it will send its
+// delegate (aka this view controller) the audio data in various ways (check out
+// the EZMicrophoneDelegate documentation for more details);
+//
+- (IBAction)toggleMicrophone:(id)sender;
+
+//------------------------------------------------------------------------------
+
+//
+// Toggles the recording mode on and off.
+//
+- (IBAction)toggleRecording:(id)sender;
+
+@end
+
+
--- /dev/null
+//
+// ViewController.m
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Dealloc
+//------------------------------------------------------------------------------
+
+- (void)dealloc
+{
+ [[NSNotificationCenter defaultCenter] removeObserver:self];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Status Bar Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Setup
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Setup the AVAudioSession. EZMicrophone will not work properly on iOS
+ // if you don't do this!
+ //
+ AVAudioSession *session = [AVAudioSession sharedInstance];
+ NSError *error;
+ [session setCategory:AVAudioSessionCategoryPlayAndRecord error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session category: %@", error.localizedDescription);
+ }
+ [session setActive:YES error:&error];
+ if (error)
+ {
+ NSLog(@"Error setting up audio session active: %@", error.localizedDescription);
+ }
+
+ //
+ // Customizing the audio plot that'll show the current microphone input/recording
+ //
+ self.recordingAudioPlot.backgroundColor = [UIColor colorWithRed: 0.984 green: 0.71 blue: 0.365 alpha: 1];
+ self.recordingAudioPlot.color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+ self.recordingAudioPlot.plotType = EZPlotTypeRolling;
+ self.recordingAudioPlot.shouldFill = YES;
+ self.recordingAudioPlot.shouldMirror = YES;
+
+ //
+ // Customizing the audio plot that'll show the playback
+ //
+ self.playingAudioPlot.color = [UIColor whiteColor];
+ self.playingAudioPlot.plotType = EZPlotTypeRolling;
+ self.playingAudioPlot.shouldFill = YES;
+ self.playingAudioPlot.shouldMirror = YES;
+ self.playingAudioPlot.gain = 2.5f;
+
+ // Create an instance of the microphone and tell it to use this view controller instance as the delegate
+ self.microphone = [EZMicrophone microphoneWithDelegate:self];
+ self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
+
+ //
+ // Override the output to the speaker. Do this after creating the EZAudioPlayer
+ // to make sure the EZAudioDevice does not reset this.
+ //
+ [session overrideOutputAudioPort:AVAudioSessionPortOverrideSpeaker error:&error];
+ if (error)
+ {
+ NSLog(@"Error overriding output to the speaker: %@", error.localizedDescription);
+ }
+
+ //
+ // Initialize UI components
+ //
+ self.microphoneStateLabel.text = @"Microphone On";
+ self.recordingStateLabel.text = @"Not Recording";
+ self.playingStateLabel.text = @"Not Playing";
+ self.playButton.enabled = NO;
+
+ //
+ // Setup notifications
+ //
+ [self setupNotifications];
+
+ //
+ // Log out where the file is being written to within the app's documents directory
+ //
+ NSLog(@"File written to application sandbox's documents directory: %@",[self testFilePathURL]);
+
+ //
+ // Start the microphone
+ //
+ [self.microphone startFetchingAudio];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)setupNotifications
+{
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(playerDidChangePlayState:)
+ name:EZAudioPlayerDidChangePlayStateNotification
+ object:self.player];
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(playerDidReachEndOfFile:)
+ name:EZAudioPlayerDidReachEndOfFileNotification
+ object:self.player];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Notifications
+//------------------------------------------------------------------------------
+
+- (void)playerDidChangePlayState:(NSNotification *)notification
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ EZAudioPlayer *player = [notification object];
+ BOOL isPlaying = [player isPlaying];
+ if (isPlaying)
+ {
+ weakSelf.recorder.delegate = nil;
+ }
+ weakSelf.playingStateLabel.text = isPlaying ? @"Playing" : @"Not Playing";
+ weakSelf.playingAudioPlot.hidden = !isPlaying;
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)playerDidReachEndOfFile:(NSNotification *)notification
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.playingAudioPlot clear];
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Actions
+//------------------------------------------------------------------------------
+
+- (void)playFile:(id)sender
+{
+ //
+ // Update microphone state
+ //
+ [self.microphone stopFetchingAudio];
+
+ //
+ // Update recording state
+ //
+ self.isRecording = NO;
+ self.recordingStateLabel.text = @"Not Recording";
+ self.recordSwitch.on = NO;
+
+ //
+ // Close the audio file
+ //
+ if (self.recorder)
+ {
+ [self.recorder closeAudioFile];
+ }
+
+ EZAudioFile *audioFile = [EZAudioFile audioFileWithURL:[self testFilePathURL]];
+ [self.player playAudioFile:audioFile];
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleMicrophone:(id)sender
+{
+ [self.player pause];
+
+ BOOL isOn = [(UISwitch*)sender isOn];
+ if (!isOn)
+ {
+ [self.microphone stopFetchingAudio];
+ }
+ else
+ {
+ [self.microphone startFetchingAudio];
+ }
+}
+
+//------------------------------------------------------------------------------
+
+- (void)toggleRecording:(id)sender
+{
+ [self.player pause];
+ if ([sender isOn])
+ {
+ //
+ // Create the recorder
+ //
+ [self.recordingAudioPlot clear];
+ [self.microphone startFetchingAudio];
+ self.recorder = [EZRecorder recorderWithURL:[self testFilePathURL]
+ clientFormat:[self.microphone audioStreamBasicDescription]
+ fileType:EZRecorderFileTypeM4A
+ delegate:self];
+ self.playButton.enabled = YES;
+ }
+ self.isRecording = (BOOL)[sender isOn];
+ self.recordingStateLabel.text = self.isRecording ? @"Recording" : @"Not Recording";
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZMicrophoneDelegate
+//------------------------------------------------------------------------------
+
+- (void)microphone:(EZMicrophone *)microphone changedPlayingState:(BOOL)isPlaying
+{
+ self.microphoneStateLabel.text = isPlaying ? @"Microphone On" : @"Microphone Off";
+ self.microphoneSwitch.on = isPlaying;
+}
+
+//------------------------------------------------------------------------------
+
+#warning Thread Safety
+//
+// Note that any callback that provides streamed audio data (like streaming
+// microphone input) happens on a separate audio thread that should not be
+// blocked. When we feed audio data into any of the UI components we need to
+// explicity create a GCD block on the main thread to properly get the UI to
+// work.
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ // Getting audio data as an array of float buffer arrays. What does that
+ // mean? Because the audio is coming in as a stereo signal the data is split
+ // into a left and right channel. So buffer[0] corresponds to the float* data
+ // for the left channel while buffer[1] corresponds to the float* data for
+ // the right channel.
+
+ //
+ // See the Thread Safety warning above, but in a nutshell these callbacks
+ // happen on a separate audio thread. We wrap any UI updating in a GCD block
+ // on the main thread to avoid blocking that audio flow.
+ //
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ //
+ // All the audio plot needs is the buffer data (float*) and the size.
+ // Internally the audio plot will handle all the drawing related code,
+ // history management, and freeing its own resources. Hence, one badass
+ // line of code gets you a pretty plot :)
+ //
+ [weakSelf.recordingAudioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void) microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ //
+ // Getting audio data as a buffer list that can be directly fed into the
+ // EZRecorder. This is happening on the audio thread - any UI updating needs
+ // a GCD main queue block. This will keep appending data to the tail of the
+ // audio file.
+ //
+ if (self.isRecording)
+ {
+ [self.recorder appendDataFromBufferList:bufferList
+ withBufferSize:bufferSize];
+ }
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZRecorderDelegate
+//------------------------------------------------------------------------------
+
+- (void)recorderDidClose:(EZRecorder *)recorder
+{
+ recorder.delegate = nil;
+}
+
+//------------------------------------------------------------------------------
+
+- (void)recorderUpdatedCurrentTime:(EZRecorder *)recorder
+{
+ __weak typeof (self) weakSelf = self;
+ NSString *formattedCurrentTime = [recorder formattedCurrentTime];
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.currentTimeLabel.text = formattedCurrentTime;
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - EZAudioPlayerDelegate
+//------------------------------------------------------------------------------
+
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.playingAudioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ weakSelf.currentTimeLabel.text = [audioPlayer formattedCurrentTime];
+ });
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Utility
+//------------------------------------------------------------------------------
+
+- (NSArray *)applicationDocuments
+{
+ return NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+}
+
+//------------------------------------------------------------------------------
+
+- (NSString *)applicationDocumentsDirectory
+{
+ NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+ NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil;
+ return basePath;
+}
+
+//------------------------------------------------------------------------------
+
+- (NSURL *)testFilePathURL
+{
+ return [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@/%@",
+ [self applicationDocumentsDirectory],
+ kAudioFilePath]];
+}
+
+@end
--- /dev/null
+//
+// main.m
+// RecordFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 66374EA81C545AEA000B19D0 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EA71C545AEA000B19D0 /* main.m */; };
+ 66374EAB1C545AEA000B19D0 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EAA1C545AEA000B19D0 /* AppDelegate.m */; };
+ 66374EAE1C545AEA000B19D0 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 66374EAD1C545AEA000B19D0 /* ViewController.m */; };
+ 66374EB11C545AEA000B19D0 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374EAF1C545AEA000B19D0 /* Main.storyboard */; };
+ 66374EB31C545AEA000B19D0 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 66374EB21C545AEA000B19D0 /* Assets.xcassets */; };
+ 66374EB61C545AEA000B19D0 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 66374EB41C545AEA000B19D0 /* LaunchScreen.storyboard */; };
+ 66374F851C547F74000B19D0 /* simple-drum-beat.wav in Resources */ = {isa = PBXBuildFile; fileRef = 66374F841C547F74000B19D0 /* simple-drum-beat.wav */; };
+ 66374F881C54804C000B19D0 /* EZAudioiOS.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F1B1C545B4F000B19D0 /* EZAudioiOS.framework */; };
+ 66374F891C54804C000B19D0 /* EZAudioiOS.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 66374F1B1C545B4F000B19D0 /* EZAudioiOS.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 66374F1A1C545B4F000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 469F4CF31B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+ 66374F1C1C545B4F000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 2;
+ remoteGlobalIDString = 8A5A4B9C1BBBDCB200A8A048;
+ remoteInfo = EZAudioOSX;
+ };
+ 66374F8A1C54804C000B19D0 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */;
+ proxyType = 1;
+ remoteGlobalIDString = 469F4CF21B749F7800666A46;
+ remoteInfo = EZAudioiOS;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 66374F8C1C54804C000B19D0 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 66374F891C54804C000B19D0 /* EZAudioiOS.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 66374EA31C545AEA000B19D0 /* WaveformFromFile.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = WaveformFromFile.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 66374EA71C545AEA000B19D0 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+ 66374EA91C545AEA000B19D0 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+ 66374EAA1C545AEA000B19D0 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+ 66374EAC1C545AEA000B19D0 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = "<group>"; };
+ 66374EAD1C545AEA000B19D0 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = "<group>"; };
+ 66374EB01C545AEA000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 66374EB21C545AEA000B19D0 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 66374EB51C545AEA000B19D0 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 66374EB71C545AEA000B19D0 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = EZAudio.xcodeproj; path = ../../../EZAudio.xcodeproj; sourceTree = "<group>"; };
+ 66374F841C547F74000B19D0 /* simple-drum-beat.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; name = "simple-drum-beat.wav"; path = "../../simple-drum-beat.wav"; sourceTree = SOURCE_ROOT; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 66374EA01C545AEA000B19D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F881C54804C000B19D0 /* EZAudioiOS.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 66374E9A1C545AEA000B19D0 = {
+ isa = PBXGroup;
+ children = (
+ 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */,
+ 66374EA51C545AEA000B19D0 /* WaveformFromFile */,
+ 66374EA41C545AEA000B19D0 /* Products */,
+ );
+ sourceTree = "<group>";
+ };
+ 66374EA41C545AEA000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EA31C545AEA000B19D0 /* WaveformFromFile.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 66374EA51C545AEA000B19D0 /* WaveformFromFile */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F841C547F74000B19D0 /* simple-drum-beat.wav */,
+ 66374EA91C545AEA000B19D0 /* AppDelegate.h */,
+ 66374EAA1C545AEA000B19D0 /* AppDelegate.m */,
+ 66374EAC1C545AEA000B19D0 /* ViewController.h */,
+ 66374EAD1C545AEA000B19D0 /* ViewController.m */,
+ 66374EAF1C545AEA000B19D0 /* Main.storyboard */,
+ 66374EB21C545AEA000B19D0 /* Assets.xcassets */,
+ 66374EB41C545AEA000B19D0 /* LaunchScreen.storyboard */,
+ 66374EB71C545AEA000B19D0 /* Info.plist */,
+ 66374EA61C545AEA000B19D0 /* Supporting Files */,
+ );
+ path = WaveformFromFile;
+ sourceTree = "<group>";
+ };
+ 66374EA61C545AEA000B19D0 /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ 66374EA71C545AEA000B19D0 /* main.m */,
+ );
+ name = "Supporting Files";
+ sourceTree = "<group>";
+ };
+ 66374F161C545B4F000B19D0 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 66374F1B1C545B4F000B19D0 /* EZAudioiOS.framework */,
+ 66374F1D1C545B4F000B19D0 /* EZAudioOSX.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 66374EA21C545AEA000B19D0 /* WaveformFromFile */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 66374EBA1C545AEA000B19D0 /* Build configuration list for PBXNativeTarget "WaveformFromFile" */;
+ buildPhases = (
+ 66374E9F1C545AEA000B19D0 /* Sources */,
+ 66374EA01C545AEA000B19D0 /* Frameworks */,
+ 66374EA11C545AEA000B19D0 /* Resources */,
+ 66374F8C1C54804C000B19D0 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 66374F8B1C54804C000B19D0 /* PBXTargetDependency */,
+ );
+ name = WaveformFromFile;
+ productName = WaveformFromFile;
+ productReference = 66374EA31C545AEA000B19D0 /* WaveformFromFile.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 66374E9B1C545AEA000B19D0 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0720;
+ ORGANIZATIONNAME = "Syed Haris Ali";
+ TargetAttributes = {
+ 66374EA21C545AEA000B19D0 = {
+ CreatedOnToolsVersion = 7.2;
+ DevelopmentTeam = M33X987285;
+ };
+ };
+ };
+ buildConfigurationList = 66374E9E1C545AEA000B19D0 /* Build configuration list for PBXProject "WaveformFromFile" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ English,
+ en,
+ Base,
+ );
+ mainGroup = 66374E9A1C545AEA000B19D0;
+ productRefGroup = 66374EA41C545AEA000B19D0 /* Products */;
+ projectDirPath = "";
+ projectReferences = (
+ {
+ ProductGroup = 66374F161C545B4F000B19D0 /* Products */;
+ ProjectRef = 66374F151C545B4F000B19D0 /* EZAudio.xcodeproj */;
+ },
+ );
+ projectRoot = "";
+ targets = (
+ 66374EA21C545AEA000B19D0 /* WaveformFromFile */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXReferenceProxy section */
+ 66374F1B1C545B4F000B19D0 /* EZAudioiOS.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioiOS.framework;
+ remoteRef = 66374F1A1C545B4F000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+ 66374F1D1C545B4F000B19D0 /* EZAudioOSX.framework */ = {
+ isa = PBXReferenceProxy;
+ fileType = wrapper.framework;
+ path = EZAudioOSX.framework;
+ remoteRef = 66374F1C1C545B4F000B19D0 /* PBXContainerItemProxy */;
+ sourceTree = BUILT_PRODUCTS_DIR;
+ };
+/* End PBXReferenceProxy section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 66374EA11C545AEA000B19D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374F851C547F74000B19D0 /* simple-drum-beat.wav in Resources */,
+ 66374EB61C545AEA000B19D0 /* LaunchScreen.storyboard in Resources */,
+ 66374EB31C545AEA000B19D0 /* Assets.xcassets in Resources */,
+ 66374EB11C545AEA000B19D0 /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 66374E9F1C545AEA000B19D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 66374EAE1C545AEA000B19D0 /* ViewController.m in Sources */,
+ 66374EAB1C545AEA000B19D0 /* AppDelegate.m in Sources */,
+ 66374EA81C545AEA000B19D0 /* main.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 66374F8B1C54804C000B19D0 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = EZAudioiOS;
+ targetProxy = 66374F8A1C54804C000B19D0 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin PBXVariantGroup section */
+ 66374EAF1C545AEA000B19D0 /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374EB01C545AEA000B19D0 /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+ 66374EB41C545AEA000B19D0 /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 66374EB51C545AEA000B19D0 /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 66374EB81C545AEA000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 66374EB91C545AEA000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../..\"";
+ IPHONEOS_DEPLOYMENT_TARGET = 9.2;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 66374EBB1C545AEA000B19D0 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = WaveformFromFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.WaveformFromFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Debug;
+ };
+ 66374EBC1C545AEA000B19D0 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ DEVELOPMENT_TEAM = M33X987285;
+ INFOPLIST_FILE = WaveformFromFile/Info.plist;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = com.sha.WaveformFromFile;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 66374E9E1C545AEA000B19D0 /* Build configuration list for PBXProject "WaveformFromFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374EB81C545AEA000B19D0 /* Debug */,
+ 66374EB91C545AEA000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 66374EBA1C545AEA000B19D0 /* Build configuration list for PBXNativeTarget "WaveformFromFile" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 66374EBB1C545AEA000B19D0 /* Debug */,
+ 66374EBC1C545AEA000B19D0 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 66374E9B1C545AEA000B19D0 /* Project object */;
+}
--- /dev/null
+//
+// AppDelegate.h
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface AppDelegate : UIResponder <UIApplicationDelegate>
+
+@property (strong, nonatomic) UIWindow *window;
+
+
+@end
+
--- /dev/null
+//
+// AppDelegate.m
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "AppDelegate.h"
+
+@interface AppDelegate ()
+
+@end
+
+@implementation AppDelegate
+
+
+- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
+ // Override point for customization after application launch.
+ return YES;
+}
+
+- (void)applicationWillResignActive:(UIApplication *)application {
+ // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
+ // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
+}
+
+- (void)applicationDidEnterBackground:(UIApplication *)application {
+ // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
+ // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
+}
+
+- (void)applicationWillEnterForeground:(UIApplication *)application {
+ // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
+}
+
+- (void)applicationDidBecomeActive:(UIApplication *)application {
+ // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
+}
+
+- (void)applicationWillTerminate:(UIApplication *)application {
+ // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
+}
+
+@end
--- /dev/null
+{
+ "images" : [
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-Small@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "57x57",
+ "idiom" : "iphone",
+ "filename" : "Icon@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "50x50",
+ "idiom" : "ipad",
+ "filename" : "Icon-Small-50@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "72x72",
+ "idiom" : "ipad",
+ "filename" : "Icon-72@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-83.5@2x.png",
+ "scale" : "2x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
+ <viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <animations/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="6nb-ry-TmX">
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="MIg-xS-PGW">
+ <objects>
+ <viewController id="6nb-ry-TmX" customClass="ViewController" sceneMemberID="viewController">
+ <layoutGuides>
+ <viewControllerLayoutGuide type="top" id="KOy-3J-Mzf"/>
+ <viewControllerLayoutGuide type="bottom" id="6WX-P2-CAm"/>
+ </layoutGuides>
+ <view key="view" contentMode="scaleToFill" id="W9I-KB-2ZB">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <subviews>
+ <view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="K6J-lA-CUh" customClass="EZAudioPlot">
+ <rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ </view>
+ </subviews>
+ <color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
+ <constraints>
+ <constraint firstItem="K6J-lA-CUh" firstAttribute="top" secondItem="W9I-KB-2ZB" secondAttribute="top" id="A7z-WB-apy"/>
+ <constraint firstAttribute="trailing" secondItem="K6J-lA-CUh" secondAttribute="trailing" id="JMN-xd-wUO"/>
+ <constraint firstItem="6WX-P2-CAm" firstAttribute="top" secondItem="K6J-lA-CUh" secondAttribute="bottom" id="MB7-uG-21G"/>
+ <constraint firstItem="K6J-lA-CUh" firstAttribute="leading" secondItem="W9I-KB-2ZB" secondAttribute="leading" id="QCP-GF-esd"/>
+ </constraints>
+ </view>
+ <connections>
+ <outlet property="audioPlot" destination="K6J-lA-CUh" id="jVL-Jl-Qp5"/>
+ <outlet property="view" destination="W9I-KB-2ZB" id="ge3-LD-lnB"/>
+ </connections>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="sE1-hp-Spj" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="235" y="405"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>en</string>
+ <key>CFBundleExecutable</key>
+ <string>$(EXECUTABLE_NAME)</string>
+ <key>CFBundleIdentifier</key>
+ <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>$(PRODUCT_NAME)</string>
+ <key>CFBundlePackageType</key>
+ <string>APPL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>LSRequiresIPhoneOS</key>
+ <true/>
+ <key>UILaunchStoryboardName</key>
+ <string>LaunchScreen</string>
+ <key>UIMainStoryboardFile</key>
+ <string>Main</string>
+ <key>UIRequiredDeviceCapabilities</key>
+ <array>
+ <string>armv7</string>
+ </array>
+ <key>UISupportedInterfaceOrientations</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>UISupportedInterfaceOrientations~ipad</key>
+ <array>
+ <string>UIInterfaceOrientationPortrait</string>
+ <string>UIInterfaceOrientationPortraitUpsideDown</string>
+ <string>UIInterfaceOrientationLandscapeLeft</string>
+ <string>UIInterfaceOrientationLandscapeRight</string>
+ </array>
+ <key>NSMicrophoneUsageDescription</key>
+ <string>录音需要使用麦克风</string>
+</dict>
+</plist>
--- /dev/null
+//
+// ViewController.h
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+
+//
+// First import the EZAudio header
+//
+#include <EZAudio/EZAudio.h>
+
+//
+// Here's the default audio file included with the example
+//
+#define kAudioFileDefault [[NSBundle mainBundle] pathForResource:@"simple-drum-beat" ofType:@"wav"]
+
+//------------------------------------------------------------------------------
+#pragma mark - ViewController
+//------------------------------------------------------------------------------
+
+@interface ViewController : UIViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Properties
+//------------------------------------------------------------------------------
+
+//
+// The EZAudioFile representing of the currently selected audio file
+//
+@property (nonatomic,strong) EZAudioFile *audioFile;
+
+//
+// The CoreGraphics based audio plot
+//
+@property (nonatomic,weak) IBOutlet EZAudioPlot *audioPlot;
+
+//
+// A label to display the current file path with the waveform shown
+//
+@property (nonatomic,weak) IBOutlet UILabel *filePathLabel;
+
+@end
+
--- /dev/null
+//
+// ViewController.m
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import "ViewController.h"
+
+@implementation ViewController
+
+//------------------------------------------------------------------------------
+#pragma mark - Status Bar Style
+//------------------------------------------------------------------------------
+
+- (UIStatusBarStyle)preferredStatusBarStyle
+{
+ return UIStatusBarStyleLightContent;
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Customize the Audio Plot
+//------------------------------------------------------------------------------
+
+- (void)viewDidLoad
+{
+ [super viewDidLoad];
+
+ //
+ // Customizing the audio plot's look
+ //
+
+ //
+ // Background color
+ //
+ self.audioPlot.backgroundColor = [UIColor colorWithRed: 0.169 green: 0.643 blue: 0.675 alpha: 1];
+
+ //
+ // Waveform color
+ //
+ self.audioPlot.color = [UIColor colorWithRed:1.0 green:1.0 blue:1.0 alpha:1.0];
+
+ //
+ // Plot type
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+
+ //
+ // Fill
+ //
+ self.audioPlot.shouldFill = YES;
+
+ //
+ // Mirror
+ //
+ self.audioPlot.shouldMirror = YES;
+
+ //
+ // No need to optimze for realtime
+ //
+ self.audioPlot.shouldOptimizeForRealtimePlot = NO;
+
+ //
+ // Customize the layer with a shadow for fun
+ //
+ self.audioPlot.waveformLayer.shadowOffset = CGSizeMake(0.0, 1.0);
+ self.audioPlot.waveformLayer.shadowRadius = 0.0;
+ self.audioPlot.waveformLayer.shadowColor = [UIColor colorWithRed: 0.069 green: 0.543 blue: 0.575 alpha: 1].CGColor;
+ self.audioPlot.waveformLayer.shadowOpacity = 1.0;
+
+ //
+ // Load in the sample file
+ //
+ [self openFileWithFilePathURL:[NSURL fileURLWithPath:kAudioFileDefault]];
+}
+
+//------------------------------------------------------------------------------
+#pragma mark - Action Extensions
+//------------------------------------------------------------------------------
+
+- (void)openFileWithFilePathURL:(NSURL*)filePathURL
+{
+ self.audioFile = [EZAudioFile audioFileWithURL:filePathURL];
+ self.filePathLabel.text = filePathURL.lastPathComponent;
+
+ //
+ // Plot the whole waveform
+ //
+ self.audioPlot.plotType = EZPlotTypeBuffer;
+ self.audioPlot.shouldFill = YES;
+ self.audioPlot.shouldMirror = YES;
+
+ //
+ // Get the audio data from the audio file
+ //
+ __weak typeof (self) weakSelf = self;
+ [self.audioFile getWaveformDataWithCompletionBlock:^(float **waveformData,
+ int length)
+ {
+ [weakSelf.audioPlot updateBuffer:waveformData[0]
+ withBufferSize:length];
+ }];
+}
+
+@end
--- /dev/null
+//
+// main.m
+// WaveformFromFile
+//
+// Created by Syed Haris Ali on 12/1/13.
+// Updated by Syed Haris Ali on 1/23/16.
+// Copyright (c) 2013 Syed Haris Ali. All rights reserved.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+
+#import <UIKit/UIKit.h>
+#import "AppDelegate.h"
+
+int main(int argc, char * argv[]) {
+ @autoreleasepool {
+ return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
+ }
+}
--- /dev/null
+The MIT License (MIT)
+
+EZAudio
+Copyright (c) 2013 Syed Haris Ali
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+
+
+A simple, intuitive audio framework for iOS and OSX.
+
+## Deprecated
+
+EZAudio has recently been deprecated in favor of [AudioKit](https://github.com/audiokit/AudioKit). However, since some people are still forking and using EZAudio I've decided to restore the README as it was. [Check out the note below](#Deprecated).
+
+## Apps Using EZAudio
+I'd really like to start creating a list of projects made using EZAudio. If you've used EZAudio to make something cool, whether it's an app or open source visualization or whatever, please email me at syedhali07[at]gmail.com and I'll add it to our wall of fame!
+To start it off:
+- [Detour](https://www.detour.com/) - Gorgeous location-aware audio walks
+- [Jumpshare](https://jumpshare.com/) - Incredibly fast, real-time file sharing
+- Piano Tuner (Home Edition)
+- Piano Tuner (Pro Edition)
+- Music Pitch Detector
+- Piano Prober
+- Multi Tuner
+
+## Features
+
+**Awesome Components**
+
+I've designed six audio components and two interface components to allow you to immediately get your hands dirty recording, playing, and visualizing audio data. These components simply plug into each other and build on top of the high-performance, low-latency AudioUnits API and give you an easy to use API written in Objective-C instead of pure C.
+
+[EZAudioDevice](#EZAudioDevice)
+
+A useful class for getting all the current and available inputs/output on any Apple device. The `EZMicrophone` and `EZOutput` use this to direct sound in/out from different hardware components.
+
+[EZMicrophone](#EZMicrophone)
+
+A microphone class that provides its delegate audio data from the default device microphone with one line of code.
+
+[EZOutput](#EZOutput)
+
+An output class that will playback any audio it is provided by its datasource.
+
+[EZAudioFile](#EZAudioFile)
+
+An audio file class that reads/seeks through audio files and provides useful delegate callbacks.
+
+[EZAudioPlayer](#EZAudioPlayer)
+
+A replacement for `AVAudioPlayer` that combines an `EZAudioFile` and a `EZOutput` to perform robust playback of any file on any piece of hardware.
+
+[EZRecorder](#EZRecorder)
+
+A recorder class that provides a quick and easy way to write audio files from any datasource.
+
+[EZAudioPlot](#EZAudioPlot)
+
+A Core Graphics-based audio waveform plot capable of visualizing any float array as a buffer or rolling plot.
+
+[EZAudioPlotGL](#EZAudioPlotGL)
+
+An OpenGL-based, GPU-accelerated audio waveform plot capable of visualizing any float array as a buffer or rolling plot.
+
+**Cross Platform**
+
+`EZAudio` was designed to work transparently across all iOS and OSX devices. This means one universal API whether you're building for Mac or iOS. For instance, under the hood an `EZAudioPlot` knows that it will subclass a UIView for iOS or an NSView for OSX and the `EZMicrophone` knows to build on top of the RemoteIO AudioUnit for iOS, but defaults to the system defaults for input and output for OSX.
+
+## <a name="Examples">Examples & Docs
+
+Within this repo you'll find the examples for iOS and OSX to get you up to speed using each component and plugging them into each other. With just a few lines of code you'll be recording from the microphone, generating audio waveforms, and playing audio files like a boss. See the full Getting Started guide for an interactive look into each of components.
+
+### Example Projects
+
+**_EZAudioCoreGraphicsWaveformExample_**
+
+
+
+Shows how to use the `EZMicrophone` and `EZAudioPlot` to visualize the audio data from the microphone in real-time. The waveform can be displayed as a buffer or a rolling waveform plot (traditional waveform look).
+
+**_EZAudioOpenGLWaveformExample_**
+
+
+
+Shows how to use the `EZMicrophone` and `EZAudioPlotGL` to visualize the audio data from the microphone in real-time. The drawing is using OpenGL so the performance much better for plots needing a lot of points.
+
+**_EZAudioPlayFileExample_**
+
+
+
+Shows how to use the `EZAudioPlayer` and `EZAudioPlotGL` to playback, pause, and seek through an audio file while displaying its waveform as a buffer or a rolling waveform plot.
+
+**_EZAudioRecordWaveformExample_**
+
+
+
+Shows how to use the `EZMicrophone`, `EZRecorder`, and `EZAudioPlotGL` to record the audio from the microphone input to a file while displaying the audio waveform of the incoming data. You can then playback the newly recorded audio file using AVFoundation and keep adding more audio data to the tail of the file.
+
+**_EZAudioWaveformFromFileExample_**
+
+
+
+Shows how to use the `EZAudioFile` and `EZAudioPlot` to animate in an audio waveform for an entire audio file.
+
+**_EZAudioPassThroughExample_**
+
+
+
+Shows how to use the `EZMicrophone`, `EZOutput`, and the `EZAudioPlotGL` to pass the microphone input to the output for playback while displaying the audio waveform (as a buffer or rolling plot) in real-time.
+
+**_EZAudioFFTExample_**
+
+
+
+Shows how to calculate the real-time FFT of the audio data coming from the `EZMicrophone` and the Accelerate framework. The audio data is plotted using two `EZAudioPlots` for the time and frequency displays.
+
+### Documentation
+The official documentation for EZAudio can be found here: http://cocoadocs.org/docsets/EZAudio/1.1.4/
+<br>You can also generate the docset yourself using appledocs by running the appledocs on the EZAudio source folder.
+
+## <a name="GettingStarted">Getting Started
+To begin using `EZAudio` you must first make sure you have the proper build requirements and frameworks. Below you'll find explanations of each component and code snippets to show how to use each to perform common tasks like getting microphone data, updating audio waveform plots, reading/seeking through audio files, and performing playback.
+
+### Build Requirements
+**iOS**
+- 6.0+
+
+**OSX**
+- 10.8+
+
+### Frameworks
+**iOS**
+- Accelerate
+- AudioToolbox
+- AVFoundation
+- GLKit
+
+**OSX**
+- Accelerate
+- AudioToolbox
+- AudioUnit
+- CoreAudio
+- QuartzCore
+- OpenGL
+- GLKit
+
+### <a name="AddingToProject">Adding To Project
+You can add EZAudio to your project in a few ways: <br><br>1.) The easiest way to use EZAudio is via <a href="http://cocoapods.org/", target="_blank">Cocoapods</a>. Simply add EZAudio to your <a href="http://guides.cocoapods.org/using/the-podfile.html", target="_blank">Podfile</a> like so:
+
+`
+pod 'EZAudio', '~> 1.1.4'
+`
+
+#### <a name="AmazingAudioEngineCocoapod">Using EZAudio & The Amazing Audio Engine
+If you're also using the Amazing Audio Engine then use the `EZAudio/Core` subspec like so:
+
+`
+pod 'EZAudio/Core', '~> 1.1.4'
+`
+
+2.) EZAudio now supports Carthage (thanks Andrew and Tommaso!). You can refer to Carthage's installation for a how-to guide:
+https://github.com/Carthage/Carthage
+
+3.) Alternatively, you can check out the iOS/Mac examples for how to setup a project using the EZAudio project as an embedded project and utilizing the frameworks. Be sure to set your header search path to the folder containing the EZAudio source.
+
+## <a name="CoreComponents"></a>Core Components
+
+`EZAudio` currently offers six audio components that encompass a wide range of functionality. In addition to the functional aspects of these components such as pulling audio data, reading/writing from files, and performing playback they also take special care to hook into the interface components to allow developers to display visual feedback (see the [Interface Components](#InterfaceComponents) below).
+
+### <a name="EZAudioDevice"></a>EZAudioDevice
+Provides a simple interface for obtaining the current and all available inputs and output for any Apple device. For instance, the iPhone 6 has three microphones available for input, while on OSX you can choose the Built-In Microphone or any available HAL device on your system. Similarly, for iOS you can choose from a pair of headphones connected or speaker, while on OSX you can choose from the Built-In Output, any available HAL device, or Airplay.
+
+
+
+#### Getting Input Devices
+To get all the available input devices use the `inputDevices` class method:
+```objectivec
+NSArray *inputDevices = [EZAudioDevice inputDevices];
+```
+
+or to just get the currently selected input device use the `currentInputDevice` method:
+```objectivec
+// On iOS this will default to the headset device or bottom microphone, while on OSX this will
+// be your selected inpupt device from the Sound preferences
+EZAudioDevice *currentInputDevice = [EZAudioDevice currentInputDevice];
+```
+
+#### Getting Output Devices
+Similarly, to get all the available output devices use the `outputDevices` class method:
+```objectivec
+NSArray *outputDevices = [EZAudioDevice outputDevices];
+```
+
+or to just get the currently selected output device use the `currentInputDevice` method:
+```objectivec
+// On iOS this will default to the headset speaker, while on OSX this will be your selected
+// output device from the Sound preferences
+EZAudioDevice *currentOutputDevice = [EZAudioDevice currentOutputDevice];
+```
+
+### <a name="EZMicrophone"></a>EZMicrophone
+Provides access to the default device microphone in one line of code and provides delegate callbacks to receive the audio data as an AudioBufferList and float arrays.
+
+**_Relevant Example Projects_**
+- EZAudioCoreGraphicsWaveformExample (iOS)
+- EZAudioCoreGraphicsWaveformExample (OSX)
+- EZAudioOpenGLWaveformExample (iOS)
+- EZAudioOpenGLWaveformExample (OSX)
+- EZAudioRecordExample (iOS)
+- EZAudioRecordExample (OSX)
+- EZAudioPassThroughExample (iOS)
+- EZAudioPassThroughExample (OSX)
+- EZAudioFFTExample (iOS)
+- EZAudioFFTExample (OSX)
+
+#### Creating A Microphone
+
+Create an `EZMicrophone` instance by declaring a property and initializing it like so:
+
+```objectivec
+// Declare the EZMicrophone as a strong property
+@property (nonatomic, strong) EZMicrophone *microphone;
+
+...
+
+// Initialize the microphone instance and assign it a delegate to receive the audio data
+// callbacks
+self.microphone = [EZMicrophone microphoneWithDelegate:self];
+```
+Alternatively, you could also use the shared `EZMicrophone` instance and just assign its `EZMicrophoneDelegate`.
+```objectivec
+// Assign a delegate to the shared instance of the microphone to receive the audio data
+// callbacks
+[EZMicrophone sharedMicrophone].delegate = self;
+```
+
+#### Setting The Device
+The `EZMicrophone` uses an `EZAudioDevice` instance to select what specific hardware destination it will use to pull audio data. You'd use this if you wanted to change the input device like in the EZAudioCoreGraphicsWaveformExample for [iOS](https://github.com/syedhali/EZAudio/tree/master/EZAudioExamples/iOS/EZAudioCoreGraphicsWaveformExample) or [OSX](https://github.com/syedhali/EZAudio/tree/master/EZAudioExamples/OSX/EZAudioCoreGraphicsWaveformExample). At any time you can change which input device is used by setting the device property:
+```objectivec
+NSArray *inputs = [EZAudioDevice inputDevices];
+[self.microphone setDevice:[inputs lastObject]];
+```
+
+Anytime the `EZMicrophone` changes its device it will trigger the `EZMicrophoneDelegate` event:
+```objectivec
+
+- (void)microphone:(EZMicrophone *)microphone changedDevice:(EZAudioDevice *)device
+{
+ // This is not always guaranteed to occur on the main thread so make sure you
+ // wrap it in a GCD block
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Update UI here
+ NSLog(@"Changed input device: %@", device);
+ });
+}
+```
+**Note: For iOS this can happen automatically if the AVAudioSession changes the current device.**
+
+#### Getting Microphone Data
+
+To tell the microphone to start fetching audio use the `startFetchingAudio` function.
+
+```objectivec
+// Starts fetching audio from the default device microphone and sends data to EZMicrophoneDelegate
+[self.microphone startFetchingAudio];
+```
+Once the `EZMicrophone` has started it will send the `EZMicrophoneDelegate` the audio back in a few ways.
+An array of float arrays:
+```objectivec
+/**
+ The microphone data represented as non-interleaved float arrays useful for:
+ - Creating real-time waveforms using EZAudioPlot or EZAudioPlotGL
+ - Creating any number of custom visualizations that utilize audio!
+ */
+-(void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+withNumberOfChannels:(UInt32)numberOfChannels
+{
+ __weak typeof (self) weakSelf = self;
+ // Getting audio data as an array of float buffer arrays that can be fed into the
+ // EZAudioPlot, EZAudioPlotGL, or whatever visualization you would like to do with
+ // the microphone data.
+ dispatch_async(dispatch_get_main_queue(),^{
+ // Visualize this data brah, buffer[0] = left channel, buffer[1] = right channel
+ [weakSelf.audioPlot updateBuffer:buffer[0] withBufferSize:bufferSize];
+ });
+}
+```
+or the AudioBufferList representation:
+```objectivec
+/**
+ The microphone data represented as CoreAudio's AudioBufferList useful for:
+ - Appending data to an audio file via the EZRecorder
+ - Playback via the EZOutput
+
+ */
+-(void) microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ // Getting audio data as an AudioBufferList that can be directly fed into the EZRecorder
+ // or EZOutput. Say whattt...
+}
+```
+#### Pausing/Resuming The Microphone
+
+Pause or resume fetching audio at any time like so:
+```objectivec
+// Stop fetching audio
+[self.microphone stopFetchingAudio];
+
+// Resume fetching audio
+[self.microphone startFetchingAudio];
+```
+
+Alternatively, you could also toggle the `microphoneOn` property (safe to use with Cocoa Bindings)
+```objectivec
+// Stop fetching audio
+self.microphone.microphoneOn = NO;
+
+// Start fetching audio
+self.microphone.microphoneOn = YES;
+```
+
+### <a name="EZOutput"></a>EZOutput
+Provides flexible playback to the default output device by asking the `EZOutputDataSource` for audio data to play. Doesn't care where the buffers come from (microphone, audio file, streaming audio, etc). As of 1.0.0 the `EZOutputDataSource` has been simplified to have only one method to provide audio data to your `EZOutput` instance.
+```objectivec
+// The EZOutputDataSource should fill out the audioBufferList with the given frame count.
+// The timestamp is provided for sample accurate calculation, but for basic use cases can
+// be ignored.
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp;
+```
+
+**_Relevant Example Projects_**
+- EZAudioPlayFileExample (iOS)
+- EZAudioPlayFileExample (OSX)
+- EZAudioPassThroughExample (iOS)
+- EZAudioPassThroughExample (OSX)
+
+#### Creating An Output
+
+Create an `EZOutput` by declaring a property and initializing it like so:
+
+```objectivec
+// Declare the EZOutput as a strong property
+@property (nonatomic, strong) EZOutput *output;
+...
+
+// Initialize the EZOutput instance and assign it a delegate to provide the output audio data
+self.output = [EZOutput outputWithDataSource:self];
+```
+Alternatively, you could also use the shared output instance and just assign it an `EZOutputDataSource` if you will only have one `EZOutput` instance for your application.
+```objectivec
+// Assign a delegate to the shared instance of the output to provide the output audio data
+[EZOutput sharedOutput].delegate = self;
+```
+#### Setting The Device
+The `EZOutput` uses an `EZAudioDevice` instance to select what specific hardware destination it will output audio to. You'd use this if you wanted to change the output device like in the [EZAudioPlayFileExample](https://github.com/syedhali/EZAudio/tree/master/EZAudioExamples/OSX/EZAudioPlayFileExample) for OSX. At any time you can change which output device is used by setting the `device` property:
+```objectivec
+// By default the EZOutput uses the default output device, but you can change this at any time
+EZAudioDevice *currentOutputDevice = [EZAudioDevice currentOutputDevice];
+[self.output setDevice:currentOutputDevice];
+```
+
+Anytime the `EZOutput` changes its device it will trigger the `EZOutputDelegate` event:
+```objectivec
+- (void)output:(EZOutput *)output changedDevice:(EZAudioDevice *)device
+{
+ NSLog(@"Change output device to: %@", device);
+}
+```
+
+#### Playing Audio
+
+##### Setting The Input Format
+
+When providing audio data the `EZOutputDataSource` will expect you to fill out the AudioBufferList provided with whatever `inputFormat` that is set on the `EZOutput`. By default the input format is a stereo, non-interleaved, float format (see [defaultInputFormat](http://cocoadocs.org/docsets/EZAudio/1.1.2/Classes/EZOutput.html#//api/name/defaultInputFormat) for more information). If you're dealing with a different input format (which is typically the case), just set the `inputFormat` property. For instance:
+```objectivec
+// Set a mono, float format with a sample rate of 44.1 kHz
+AudioStreamBasicDescription monoFloatFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:44100.0f];
+[self.output setInputFormat:monoFloatFormat];
+```
+##### Implementing the EZOutputDataSource
+
+An example of implementing the `EZOutputDataSource` is done internally in the `EZAudioPlayer` using an `EZAudioFile` to read audio from an audio file on disk like so:
+```objectivec
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp
+{
+ if (self.audioFile)
+ {
+ UInt32 bufferSize; // amount of frames actually read
+ BOOL eof; // end of file
+ [self.audioFile readFrames:frames
+ audioBufferList:audioBufferList
+ bufferSize:&bufferSize
+ eof:&eof];
+ if (eof && [self.delegate respondsToSelector:@selector(audioPlayer:reachedEndOfAudioFile:)])
+ {
+ [self.delegate audioPlayer:self reachedEndOfAudioFile:self.audioFile];
+ }
+ if (eof && self.shouldLoop)
+ {
+ [self seekToFrame:0];
+ }
+ else if (eof)
+ {
+ [self pause];
+ [self seekToFrame:0];
+ [[NSNotificationCenter defaultCenter] postNotificationName:EZAudioPlayerDidReachEndOfFileNotification
+ object:self];
+ }
+ }
+ return noErr;
+}
+```
+
+I created a sample project that uses the `EZOutput` to act as a signal generator to play sine, square, triangle, sawtooth, and noise waveforms. **Here's a snippet of code to generate a sine tone**:
+```objectivec
+...
+double const SAMPLE_RATE = 44100.0;
+
+- (void)awakeFromNib
+{
+ //
+ // Create EZOutput to play audio data with mono format (EZOutput will convert
+ // this mono, float "inputFormat" to a clientFormat, i.e. the stereo output format).
+ //
+ AudioStreamBasicDescription inputFormat = [EZAudioUtilities monoFloatFormatWithSampleRate:SAMPLE_RATE];
+ self.output = [EZOutput outputWithDataSource:self inputFormat:inputFormat];
+ [self.output setDelegate:self];
+ self.frequency = 200.0;
+ self.sampleRate = SAMPLE_RATE;
+ self.amplitude = 0.80;
+}
+
+- (OSStatus) output:(EZOutput *)output
+ shouldFillAudioBufferList:(AudioBufferList *)audioBufferList
+ withNumberOfFrames:(UInt32)frames
+ timestamp:(const AudioTimeStamp *)timestamp
+{
+ Float32 *buffer = (Float32 *)audioBufferList->mBuffers[0].mData;
+ size_t bufferByteSize = (size_t)audioBufferList->mBuffers[0].mDataByteSize;
+ double theta = self.theta;
+ double frequency = self.frequency;
+ double thetaIncrement = 2.0 * M_PI * frequency / SAMPLE_RATE;
+ if (self.type == GeneratorTypeSine)
+ {
+ for (UInt32 frame = 0; frame < frames; frame++)
+ {
+ buffer[frame] = self.amplitude * sin(theta);
+ theta += thetaIncrement;
+ if (theta > 2.0 * M_PI)
+ {
+ theta -= 2.0 * M_PI;
+ }
+ }
+ self.theta = theta;
+ }
+ else if (... other shapes in full source)
+}
+```
+
+For the full implementation of the square, triangle, sawtooth, and noise functions here: (https://github.com/syedhali/SineExample/blob/master/SineExample/GeneratorViewController.m#L220-L305)
+
+Once the `EZOutput` has started it will send the `EZOutputDelegate` the audio back as float arrays for visualizing. These are converted inside the `EZOutput` component from whatever input format you may have provided. For instance, if you provide an interleaved, signed integer AudioStreamBasicDescription for the `inputFormat` property then that will be automatically converted to a stereo, non-interleaved, float format when sent back in the delegate `playedAudio:...` method below:
+An array of float arrays:
+```objectivec
+/**
+ The output data represented as non-interleaved float arrays useful for:
+ - Creating real-time waveforms using EZAudioPlot or EZAudioPlotGL
+ - Creating any number of custom visualizations that utilize audio!
+ */
+- (void) output:(EZOutput *)output
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Update plot, buffer[0] = left channel, buffer[1] = right channel
+ });
+}
+```
+
+#### Pausing/Resuming The Output
+Pause or resume the output component at any time like so:
+```objectivec
+// Stop fetching audio
+[self.output stopPlayback];
+
+// Resume fetching audio
+[self.output startPlayback];
+```
+
+#### Chaining Audio Unit Effects
+Internally the `EZOutput` is using an AUGraph to chain together a converter, mixer, and output audio units. You can hook into this graph by subclassing `EZOutput` and implementing the method:
+```objectivec
+// By default this method connects the AUNode representing the input format converter to
+// the mixer node. In subclasses you can add effects in the chain between the converter
+// and mixer by creating additional AUNodes, adding them to the AUGraph provided below,
+// and then connecting them together.
+- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
+ sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
+ toDestinationNode:(AUNode)destinationNode
+ destinationNodeInputBus:(UInt32)destinationNodeInputBus
+ inGraph:(AUGraph)graph;
+```
+
+This was inspired by the audio processing graph from CocoaLibSpotify (Daniel Kennett of Spotify has [an excellent blog post](http://ikennd.ac/blog/2012/04/augraph-basics-in-cocoalibspotify/) explaining how to add an EQ to the CocoaLibSpotify AUGraph).
+
+Here's an example of how to add a delay audio unit (`kAudioUnitSubType_Delay`):
+```objectivec
+// In interface, declare delay node info property
+@property (nonatomic, assign) EZAudioNodeInfo *delayNodeInfo;
+
+// In implementation, overwrite the connection method
+- (OSStatus)connectOutputOfSourceNode:(AUNode)sourceNode
+ sourceNodeOutputBus:(UInt32)sourceNodeOutputBus
+ toDestinationNode:(AUNode)destinationNode
+ destinationNodeInputBus:(UInt32)destinationNodeInputBus
+ inGraph:(AUGraph)graph
+{
+ self.delayNodeInfo = (EZAudioNodeInfo *)malloc(sizeof(EZAudioNodeInfo));
+
+ // A description for the time/pitch shifter Device
+ AudioComponentDescription delayComponentDescription;
+ delayComponentDescription.componentType = kAudioUnitType_Effect;
+ delayComponentDescription.componentSubType = kAudioUnitSubType_Delay;
+ delayComponentDescription.componentManufacturer = kAudioUnitManufacturer_Apple;
+ delayComponentDescription.componentFlags = 0;
+ delayComponentDescription.componentFlagsMask = 0;
+
+ [EZAudioUtilities checkResult:AUGraphAddNode(graph,
+ &delayComponentDescription,
+ &self.delayNodeInfo->node)
+ operation:"Failed to add node for time shift"];
+
+ // Get the time/pitch shifter Audio Unit from the node
+ [EZAudioUtilities checkResult:AUGraphNodeInfo(graph,
+ self.delayNodeInfo->node,
+ NULL,
+ &self.delayNodeInfo->audioUnit)
+ operation:"Failed to get audio unit for delay node"];
+
+ // connect the output of the input source node to the input of the time/pitch shifter node
+ [EZAudioUtilities checkResult:AUGraphConnectNodeInput(graph,
+ sourceNode,
+ sourceNodeOutputBus,
+ self.delayNodeInfo->node,
+ 0)
+ operation:"Failed to connect source node into delay node"];
+
+ // connect the output of the time/pitch shifter node to the input of the destination node, thus completing the chain.
+ [EZAudioUtilities checkResult:AUGraphConnectNodeInput(graph,
+ self.delayNodeInfo->node,
+ 0,
+ destinationNode,
+ destinationNodeInputBus)
+ operation:"Failed to connect delay to destination node"];
+ return noErr;
+}
+
+// Clean up
+- (void)dealloc
+{
+ free(self.delayNodeInfo);
+}
+```
+
+### <a name="EZAudioFile"></a>EZAudioFile
+Provides simple read/seek operations, pulls waveform amplitude data, and provides the `EZAudioFileDelegate` to notify of any read/seek action occuring on the `EZAudioFile`. This can be thought of as the NSImage/UIImage equivalent of the audio world.
+
+**_Relevant Example Projects_**
+- EZAudioWaveformFromFileExample (iOS)
+- EZAudioWaveformFromFileExample (OSX)
+
+#### Opening An Audio File
+To open an audio file create a new instance of the `EZAudioFile` class.
+```objectivec
+// Declare the EZAudioFile as a strong property
+@property (nonatomic, strong) EZAudioFile *audioFile;
+
+...
+
+// Initialize the EZAudioFile instance and assign it a delegate to receive the read/seek callbacks
+self.audioFile = [EZAudioFile audioFileWithURL:[NSURL fileURLWithPath:@"/path/to/your/file"] delegate:self];
+```
+
+#### Getting Waveform Data
+
+The EZAudioFile allows you to quickly fetch waveform data from an audio file with as much or little detail as you'd like.
+```objectivec
+__weak typeof (self) weakSelf = self;
+// Get a waveform with 1024 points of data. We can adjust the number of points to whatever level
+// of detail is needed by the application
+[self.audioFile getWaveformDataWithNumberOfPoints:1024
+ completionBlock:^(float **waveformData,
+ int length)
+{
+ [weakSelf.audioPlot updateBuffer:waveformData[0]
+ withBufferSize:length];
+}];
+```
+
+#### Reading From An Audio File
+
+Reading audio data from a file requires you to create an AudioBufferList to hold the data. The `EZAudio` utility function, `audioBufferList`, provides a convenient way to get an allocated AudioBufferList to use. There is also a utility function, `freeBufferList:`, to use to free (or release) the AudioBufferList when you are done using that audio data.
+
+**Note: You have to free the AudioBufferList, even in ARC.**
+```objectivec
+// Allocate an AudioBufferList to hold the audio data (the client format is the non-compressed
+// in-app format that is used for reading, it's different than the file format which is usually
+// something compressed like an mp3 or m4a)
+AudioStreamBasicDescription clientFormat = [self.audioFile clientFormat];
+UInt32 numberOfFramesToRead = 512;
+UInt32 channels = clientFormat.mChannelsPerFrame;
+BOOL isInterleaved = [EZAudioUtilities isInterleaved:clientFormat];
+AudioBufferList *bufferList = [EZAudioUtilities audioBufferListWithNumberOfFrames:numberOfFramesToRead
+ numberOfChannels:channels
+ interleaved:isInterleaved];
+
+// Read the frames from the EZAudioFile into the AudioBufferList
+UInt32 framesRead;
+UInt32 isEndOfFile;
+[self.audioFile readFrames:numberOfFramesToRead
+ audioBufferList:bufferList
+ bufferSize:&framesRead
+ eof:&isEndOfFile]
+```
+
+When a read occurs the `EZAudioFileDelegate` receives two events.
+
+An event notifying the delegate of the read audio data as float arrays:
+```objectivec
+-(void) audioFile:(EZAudioFile *)audioFile
+ readAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+```
+and an event notifying the delegate of the new frame position within the `EZAudioFile`:
+```objectivec
+-(void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Update UI
+ });
+}
+```
+
+#### Seeking Through An Audio File
+
+You can seek very easily through an audio file using the `EZAudioFile`'s seekToFrame: method. The `EZAudioFile` provides a `totalFrames` method to provide you the total amount of frames in an audio file so you can calculate a proper offset.
+```objectivec
+// Get the total number of frames for the audio file
+SInt64 totalFrames = [self.audioFile totalFrames];
+
+// Seeks halfway through the audio file
+[self.audioFile seekToFrame:(totalFrames/2)];
+
+// Alternatively, you can seek using seconds
+NSTimeInterval duration = [self.audioFile duration];
+[self.audioFile setCurrentTime:duration/2.0];
+```
+When a seek occurs the `EZAudioFileDelegate` receives the seek event:
+```objectivec
+-(void)audioFile:(EZAudioFile *)audioFile updatedPosition:(SInt64)framePosition
+{
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Update UI
+ });
+}
+```
+
+### <a name="EZAudioPlayer"></a>EZAudioPlayer
+Provides a class that combines the `EZAudioFile` and `EZOutput` for file playback of all Core Audio supported formats to any hardware device. Because the `EZAudioPlayer` internally hooks into the `EZAudioFileDelegate` and `EZOutputDelegate`, you should implement the `EZAudioPlayerDelegate` to receive the `playedAudio:...` and `updatedPosition:` events. The EZAudioPlayFileExample projects for [iOS](https://github.com/syedhali/EZAudio/tree/master/EZAudioExamples/iOS/EZAudioPlayFileExample) and [OSX](https://github.com/syedhali/EZAudio/tree/master/EZAudioExamples/OSX/EZAudioPlayFileExample) shows how to use the `EZAudioPlayer` to play audio files, visualize the samples with an audio plot, adjust the volume, and change the output device using the `EZAudioDevice` class. The `EZAudioPlayer` primarily uses `NSNotificationCenter` to post notifications because often times you have one audio player and multiple UI elements that need to listen for player events to properly update.
+
+#### Creating An Audio Player
+```objectivec
+// Declare the EZAudioFile as a strong property
+@property (nonatomic, strong) EZAudioFile *audioFile;
+
+...
+
+// Create an EZAudioPlayer with a delegate that conforms to EZAudioPlayerDelegate
+self.player = [EZAudioPlayer audioPlayerWithDelegate:self];
+```
+
+#### Playing An Audio File
+The `EZAudioPlayer` uses an internal `EZAudioFile` to provide data to its `EZOutput` for output via the `EZOutputDataSource`. You can provide an `EZAudioFile` by just setting the `audioFile` property on the `EZAudioPlayer` will make a copy of the `EZAudioFile` at that file path url for its own use.
+```objectivec
+// Set the EZAudioFile for playback by setting the `audioFile` property
+EZAudioFile *audioFile = [EZAudioFile audioFileWithURL:[NSURL fileURLWithPath:@"/path/to/your/file"]];
+[self.player setAudioFile:audioFile];
+
+// This, however, will not pause playback if a current file is playing. Instead
+// it's encouraged to use `playAudioFile:` instead if you're swapping in a new
+// audio file while playback is already running
+EZAudioFile *audioFile = [EZAudioFile audioFileWithURL:[NSURL fileURLWithPath:@"/path/to/your/file"]];
+[self.player playAudioFile:audioFile];
+```
+
+As audio is played the `EZAudioPlayerDelegate` will receive the `playedAudio:...`, `updatedPosition:...`, and, if the audio file reaches the end of the file, the `reachedEndOfAudioFile:` events. A typical implementation of the `EZAudioPlayerDelegate` would be something like:
+```objectivec
+- (void) audioPlayer:(EZAudioPlayer *)audioPlayer
+ playedAudio:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ // Update an EZAudioPlot or EZAudioPlotGL to reflect the audio data coming out
+ // of the EZAudioPlayer (post volume and pan)
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0]
+ withBufferSize:bufferSize];
+ });
+}
+
+//------------------------------------------------------------------------------
+
+- (void)audioPlayer:(EZAudioPlayer *)audioPlayer
+ updatedPosition:(SInt64)framePosition
+ inAudioFile:(EZAudioFile *)audioFile
+{
+ __weak typeof (self) weakSelf = self;
+ // Update any UI controls including sliders and labels
+ // display current time/duration
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if (!weakSelf.positionSlider.highlighted)
+ {
+ weakSelf.positionSlider.floatValue = (float)framePosition;
+ weakSelf.positionLabel.integerValue = framePosition;
+ }
+ });
+}
+```
+
+#### Seeking
+You can seek through the audio file in a similar fashion as with the `EZAudioFile`. That is, using the `seekToFrame:` or `currentTime` property.
+```objectivec
+// Get the total number of frames and seek halfway
+SInt64 totalFrames = [self.player totalFrames];
+[self.player seekToFrame:(totalFrames/2)];
+
+// Alternatively, you can seek using seconds
+NSTimeInterval duration = [self.player duration];
+[self.player setCurrentTime:duration/2.0];
+```
+
+#### Setting Playback Parameters
+Because the `EZAudioPlayer` wraps the `EZOutput` you can adjust the volume and pan parameters for playback.
+```objectivec
+// Make it half as loud, 0 = silence, 1 = full volume. Default is 1.
+[self.player setVolume:0.5];
+
+// Make it only play on the left, -1 = left, 1 = right. Default is 0.0 (center)
+[self.player setPan:-1.0];
+```
+
+#### Getting Audio File Parameters
+The `EZAudioPlayer` wraps the `EZAudioFile` and provides a high level interface for pulling values like current time, duration, the frame index, total frames, etc.
+```objectivec
+NSTimeInterval currentTime = [self.player currentTime];
+NSTimeInterval duration = [self.player duration];
+NSString *formattedCurrentTime = [self.player formattedCurrentTime]; // MM:SS formatted
+NSString *formattedDuration = [self.player formattedDuration]; // MM:SS formatted
+SInt64 frameIndex = [self.player frameIndex];
+SInt64 totalFrames = [self.player totalFrames];
+```
+
+In addition, the `EZOutput` properties are also offered at a high level as well:
+```objectivec
+EZAudioDevice *outputDevice = [self.player device];
+BOOL isPlaying = [self.player isPlaying];
+float pan = [self.player pan];
+float volume = [self.player volume];
+```
+
+#### Notifications
+The `EZAudioPlayer` provides the following notifications (as of 1.1.2):
+```objectivec
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `audioFile` property. Check the new value using the EZAudioPlayer's `audioFile` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeAudioFileNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `device` property. Check the new value using the EZAudioPlayer's `device` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeOutputDeviceNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's `pan` property. Check the new value using the EZAudioPlayer's `pan` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePanNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's play state. Check the new value using the EZAudioPlayer's `isPlaying` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangePlayStateNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer changes its `output` component's `volume` property. Check the new value using the EZAudioPlayer's `volume` property.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidChangeVolumeNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer has reached the end of a file and its `shouldLoop` property has been set to NO.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidReachEndOfFileNotification;
+
+/**
+ Notification that occurs whenever the EZAudioPlayer performs a seek via the `seekToFrame` method or `setCurrentTime:` property setter. Check the new `currentTime` or `frameIndex` value using the EZAudioPlayer's `currentTime` or `frameIndex` property, respectively.
+ */
+FOUNDATION_EXPORT NSString * const EZAudioPlayerDidSeekNotification;
+```
+
+### <a name="EZRecorder"></a>EZRecorder
+Provides a way to record any audio source to an audio file. This hooks into the other components quite nicely to do something like plot the audio waveform while recording to give visual feedback as to what is happening. The `EZRecorderDelegate` provides methods to listen to write events and a final close event on the `EZRecorder` (explained [below](#EZRecorderDelegateExplanation)).
+
+*Relevant Example Projects*
+- EZAudioRecordExample (iOS)
+- EZAudioRecordExample (OSX)
+
+#### Creating A Recorder
+
+To create an `EZRecorder` you must provide at least 3 things: an NSURL representing the file path of where the audio file should be written to (an existing file will be overwritten), a `clientFormat` representing the format in which you will be providing the audio data, and either an `EZRecorderFileType` or an `AudioStreamBasicDescription` representing the file format of the audio data on disk.
+
+```objectivec
+// Provide a file path url to write to, a client format (always linear PCM, this is the format
+// coming from another component like the EZMicrophone's audioStreamBasicDescription property),
+// and a EZRecorderFileType constant representing either a wav (EZRecorderFileTypeWAV),
+// aiff (EZRecorderFileTypeAIFF), or m4a (EZRecorderFileTypeM4A) file format. The advantage of
+// this is that the `fileFormat` property will be automatically filled out for you.
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileType:(EZRecorderFileType)fileType;
+
+// Alternatively, you can provide a file path url to write to, a client format (always linear
+// PCM, this is the format coming from another component like the EZMicrophone's
+// audioStreamBasicDescription property), a `fileFormat` representing your custom
+// AudioStreamBasicDescription, and an AudioFileTypeID that corresponds with your `fileFormat`.
++ (instancetype)recorderWithURL:(NSURL *)url
+ clientFormat:(AudioStreamBasicDescription)clientFormat
+ fileFormat:(AudioStreamBasicDescription)fileFormat
+ audioFileTypeID:(AudioFileTypeID)audioFileTypeID;
+
+```
+
+Start by declaring an instance of the EZRecorder (you will have one of these per audio file written out)
+```objectivec
+// Declare the EZRecorder as a strong property
+@property (nonatomic, strong) EZRecorder *recorder;
+```
+
+and initialize it using one of the two initializers from above. For instance, using the `EZRecorderFileType` shortcut initializer you could create an instance like so:
+```objectivec
+// Example using an EZMicrophone and a string called kAudioFilePath representing a file
+// path location on your computer to write out a M4A file.
+self.recorder = [EZRecorder recorderWithURL:[NSURL fileURLWithPath:@"/path/to/your/file.m4a"]
+ clientFormat:[self.microphone audioStreamBasicDescription]
+ fileType:EZRecorderFileTypeM4A];
+```
+
+or to configure your own custom file format, say to write out a 8000 Hz, iLBC file:
+```objectivec
+// Example using an EZMicrophone, a string called kAudioFilePath representing a file
+// path location on your computer, and an iLBC file format.
+AudioStreamBasicDescription iLBCFormat = [EZAudioUtilities iLBCFormatWithSampleRate:8000];
+self.recorder = [EZRecorder recorderWithURL:[NSURL fileURLWithPath:@"/path/to/your/file.caf"]
+ clientFormat:[self.microphone audioStreamBasicDescription]
+ fileFormat:iLBCFormat
+ audioFileTypeID:kAudioFileCAFType];
+```
+
+#### Recording Some Audio
+
+Once you've initialized your `EZRecorder` you can append data by passing in an AudioBufferList and its buffer size like so:
+```objectivec
+// Append the microphone data coming as a AudioBufferList with the specified buffer size
+// to the recorder
+-(void) microphone:(EZMicrophone *)microphone
+ hasBufferList:(AudioBufferList *)bufferList
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ // Getting audio data as a buffer list that can be directly fed into the EZRecorder. This is
+ // happening on the audio thread - any UI updating needs a GCD main queue block.
+ if (self.isRecording)
+ {
+ // Since we set the recorder's client format to be that of the EZMicrophone instance,
+ // the audio data coming in represented by the AudioBufferList can directly be provided
+ // to the EZRecorder. The EZRecorder will internally convert the audio data from the
+ // `clientFormat` to `fileFormat`.
+ [self.recorder appendDataFromBufferList:bufferList
+ withBufferSize:bufferSize];
+ }
+}
+```
+
+##### <a name="EZRecorderDelegateExplanation"></a>Responding to an EZRecorder after it has written audio data
+
+Once audio data has been successfully written with the `EZRecorder` it will notify the `EZRecorderDelegate` of the event so it can respond via:
+```objectivec
+// Triggers after the EZRecorder's `appendDataFromBufferList:withBufferSize:` method is called
+// so you can update your interface accordingly.
+- (void)recorderUpdatedCurrentTime:(EZRecorder *)recorder
+{
+ __weak typeof (self) weakSelf = self;
+ // This will get triggerd on the thread that the write occured on so be sure to wrap your UI
+ // updates in a GCD main queue block! However, I highly recommend you first pull the values
+ // you'd like to update the interface with before entering the GCD block to avoid trying to
+ // fetch a value after the audio file has been closed.
+ NSString *formattedCurrentTime = [recorder formattedCurrentTime]; // MM:SS formatted
+ dispatch_async(dispatch_get_main_queue(), ^{
+ // Update label
+ weakSelf.currentTimeLabel.stringValue = formattedCurrentTime;
+ });
+}
+```
+
+#### Closing An Audio File
+When you're recording is done be sure to call the `closeAudioFile` method to make sure the audio file written to disk is properly closed before you attempt to read it again.
+
+```objectivec
+// Close the EZRecorder's audio file BEFORE reading
+[self.recorder closeAudioFile];
+```
+
+This will trigger the EZRecorder's delegate method:
+```objectivec
+- (void)recorderDidClose:(EZRecorder *)recorder
+{
+ recorder.delegate = nil;
+}
+```
+
+## <a name="InterfaceComponents"></a>Interface Components
+`EZAudio` currently offers two drop in audio waveform components that help simplify the process of visualizing audio.
+
+### <a name="EZAudioPlot"></a>EZAudioPlot
+Provides an audio waveform plot that uses CoreGraphics to perform the drawing. On iOS this is a subclass of UIView while on OSX this is a subclass of NSView. As of the 1.0.0 release, the waveforms are drawn using CALayers where compositing is done on the GPU. As a result, there have been some huge performance gains and CPU usage per real-time (i.e. 60 frames per second redrawing) plot is now about 2-3% CPU as opposed to the 20-30% we were experiencing before.
+
+*Relevant Example Projects*
+- EZAudioCoreGraphicsWaveformExample (iOS)
+- EZAudioCoreGraphicsWaveformExample (OSX)
+- EZAudioRecordExample (iOS)
+- EZAudioRecordExample (OSX)
+- EZAudioWaveformFromFileExample (iOS)
+- EZAudioWaveformFromFileExample (OSX)
+- EZAudioFFTExample (iOS)
+- EZAudioFFTExample (OSX)
+
+#### Creating An Audio Plot
+
+You can create an audio plot in the interface builder by dragging in a UIView on iOS or an NSView on OSX onto your content area. Then change the custom class of the UIView/NSView to `EZAudioPlot`.
+
+
+
+Alternatively, you can could create the audio plot programmatically
+
+```objectivec
+// Programmatically create an audio plot
+EZAudioPlot *audioPlot = [[EZAudioPlot alloc] initWithFrame:self.view.frame];
+[self.view addSubview:audioPlot];
+```
+
+#### Customizing The Audio Plot
+
+All plots offer the ability to change the background color, waveform color, plot type (buffer or rolling), toggle between filled and stroked, and toggle between mirrored and unmirrored (about the x-axis). For iOS colors are of the type UIColor while on OSX colors are of the type NSColor.
+
+```objectivec
+// Background color (use UIColor for iOS)
+audioPlot.backgroundColor = [NSColor colorWithCalibratedRed:0.816
+ green:0.349
+ blue:0.255
+ alpha:1];
+// Waveform color (use UIColor for iOS)
+audioPlot.color = [NSColor colorWithCalibratedRed:1.000
+ green:1.000
+ blue:1.000
+ alpha:1];
+// Plot type
+audioPlot.plotType = EZPlotTypeBuffer;
+// Fill
+audioPlot.shouldFill = YES;
+// Mirror
+audioPlot.shouldMirror = YES;
+```
+
+#### IBInspectable Attributes
+
+Also, as of iOS 8 you can adjust the background color, color, gain, shouldFill, and shouldMirror parameters directly in the Interface Builder via the IBInspectable attributes:
+
+
+
+#### Updating The Audio Plot
+
+All plots have only one update function, `updateBuffer:withBufferSize:`, which expects a float array and its length.
+```objectivec
+// The microphone component provides audio data to its delegate as an array of float buffer arrays.
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ /**
+ Update the audio plot using the float array provided by the microphone:
+ buffer[0] = left channel
+ buffer[1] = right channel
+ Note: Audio updates happen asynchronously so we need to make sure
+ sure to update the plot on the main thread
+ */
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlot updateBuffer:buffer[0] withBufferSize:bufferSize];
+ });
+}
+```
+
+### <a name="EZAudioPlotGL"></a>EZAudioPlotGL
+Provides an audio waveform plot that uses OpenGL to perform the drawing. The API this class are exactly the same as those for the EZAudioPlot above. On iOS this is a subclass of the GLKView while on OSX this is a subclass of the NSOpenGLView. In most cases this is the plot you want to use, it's GPU-accelerated, can handle lots of points while displaying 60 frames per second (the EZAudioPlot starts to choke on anything greater than 1024), and performs amazingly on all devices. The only downside is that you can only have one OpenGL plot onscreen at a time. However, you can combine OpenGL plots with Core Graphics plots in the view hierachy (see the EZAudioRecordExample for an example of how to do this).
+
+*Relevant Example Projects*
+- EZAudioOpenGLWaveformExample (iOS)
+- EZAudioOpenGLWaveformExample (OSX)
+- EZAudioPlayFileExample (iOS)
+- EZAudioPlayFileExample (OSX)
+- EZAudioRecordExample (iOS)
+- EZAudioRecordExample (OSX)
+- EZAudioPassThroughExample (iOS)
+- EZAudioPassThroughExample (OSX)
+
+#### Creating An OpenGL Audio Plot
+
+You can create an audio plot in the interface builder by dragging in a UIView on iOS or an NSView on OSX onto your content area. Then change the custom class of the UIView/NSView to `EZAudioPlotGL`.
+
+
+
+Alternatively, you can could create the `EZAudioPlotGL` programmatically
+```objectivec
+// Programmatically create an audio plot
+EZAudioPlotGL *audioPlotGL = [[EZAudioPlotGL alloc] initWithFrame:self.view.frame];
+[self.view addSubview:audioPlotGL];
+```
+
+#### Customizing The OpenGL Audio Plot
+
+All plots offer the ability to change the background color, waveform color, plot type (buffer or rolling), toggle between filled and stroked, and toggle between mirrored and unmirrored (about the x-axis). For iOS colors are of the type UIColor while on OSX colors are of the type NSColor.
+```objectivec
+// Background color (use UIColor for iOS)
+audioPlotGL.backgroundColor = [NSColor colorWithCalibratedRed:0.816
+ green:0.349
+ blue:0.255
+ alpha:1];
+// Waveform color (use UIColor for iOS)
+audioPlotGL.color = [NSColor colorWithCalibratedRed:1.000
+ green:1.000
+ blue:1.000
+ alpha:1];
+// Plot type
+audioPlotGL.plotType = EZPlotTypeBuffer;
+// Fill
+audioPlotGL.shouldFill = YES;
+// Mirror
+audioPlotGL.shouldMirror = YES;
+```
+
+#### IBInspectable Attributes
+
+Also, as of iOS 8 you can adjust the background color, color, gain, shouldFill, and shouldMirror parameters directly in the Interface Builder via the IBInspectable attributes:
+
+
+
+#### Updating The OpenGL Audio Plot
+
+All plots have only one update function, `updateBuffer:withBufferSize:`, which expects a float array and its length.
+```objectivec
+// The microphone component provides audio data to its delegate as an array of float buffer arrays.
+- (void) microphone:(EZMicrophone *)microphone
+ hasAudioReceived:(float **)buffer
+ withBufferSize:(UInt32)bufferSize
+ withNumberOfChannels:(UInt32)numberOfChannels
+{
+ /**
+ Update the audio plot using the float array provided by the microphone:
+ buffer[0] = left channel
+ buffer[1] = right channel
+ Note: Audio updates happen asynchronously so we need to make sure
+ sure to update the plot on the main thread
+ */
+ __weak typeof (self) weakSelf = self;
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [weakSelf.audioPlotGL updateBuffer:buffer[0] withBufferSize:bufferSize];
+ });
+}
+```
+
+## License
+EZAudio is available under the MIT license. See the LICENSE file for more info.
+
+## Contact & Contributers
+Syed Haris Ali<br>
+www.syedharisali.com<br>
+syedhali07[at]gmail.com
+
+## Acknowledgements
+The following people rock:
+- My brother, [Reza Ali](http://www.syedrezaali.com/), for walking me through all the gritty details of OpenGL and his constant encouragement through this journey to 1.0.0.
+- [Aure Prochazka](http://aure.com/) for his amazing work on [AudioKit](http://audiokit.io/) and his encouragement to bring EZAudio to 1.0.0
+- [Daniel Kennett](http://ikennd.ac/) for writing [this great blog post](http://ikennd.ac/blog/2012/04/augraph-basics-in-cocoalibspotify/) that inspired the rewrite of the `EZOutput` in 1.0.0.
+- [Michael Tyson](http://atastypixel.com/blog/) for creating the [TPCircularBuffer](http://atastypixel.com/blog/a-simple-fast-circular-buffer-implementation-for-audio-processing/) and all his contributions to the community including the Amazing Audio Engine, Audiobus, and all the tasty pixel blog posts.
+- Chris Adamson and Kevin Avila for writing the amazing [Learning Core Audio](http://www.amazon.com/Learning-Core-Audio-Hands-On-Programming/dp/0321636848) book.
+
+## <a name="Deprecated"></a>Deprecated
+
+
+
+As of today, June 13, 2016, I’m officially deprecating EZAudio. I’d like to thank everyone for the support over the last few years I’ve been hacking on EZAudio and working to make it better.
+
+### Alternatives
+
+The best alternative to EZAudio is now [AudioKit](http://audiokit.io/). Note that [The Amazing Audio Engine](https://github.com/TheAmazingAudioEngine/TheAmazingAudioEngine) and [The Amazing Audio Engine 2](https://github.com/TheAmazingAudioEngine/TheAmazingAudioEngine2) have now both been retired as well. Any further contributions I make to iOS/macOS/tvOS audio programming will be to AudioKit.
+
+- [AudioKit](https://github.com/audiokit/AudioKit)
+
+### Why?
+
+EZAudio started as a pet project of mine in 2013 in an attempt to reduce the amount of duplicate code I was writing for my own iOS/Mac audio projects. I originally just wanted to record audio from an iPhone’s mic and plot a waveform. This over time quickly grew into the collection of classes you may know today (EZMicrophone, EZAudioPlot, etc).
+
+I apologize for not being more active in addressing the issues and pull requests, but I’m hoping you all understand I’m only one person. EZAudio was solely written and maintained by me out of love during weeks of time I wasn’t making any money, all while living in one of the most expensive cities in the world. Like many of you, I spend the majority of my time working full-time to sustain myself (I have bills and rent to pay too!). I’m transitioning to non-audio ventures and will hopefully be able to share another cool open source project soon enough.
+
+Getting the opportunity to work on EZAudio with all of you has been an incredibly insightful experience and I’m incredibly grateful to have gotten a chance to share it with all of you. Thank you.
+
+### Is all of it broken?
+
+As I’m writing this I’m a little hesitant to say it’s all broken (despite all the issues filed), but I’d recommend forking this repo from this point forward and using at your own risk. I’ll probably be continuing to use EZAudio’s EZAudioPlot for rendering waveforms in my future projects, however, please don’t expect any updates to this repo. Deprecated means I won’t be responding to issues, EZAudio-related emails, or pushing any new changes to this repo.
--- /dev/null
+#if 0
+#elif defined(__arm64__) && __arm64__
+// Generated by Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+#ifndef JOYGEMAI_SWIFT_H
+#define JOYGEMAI_SWIFT_H
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wgcc-compat"
+
+#if !defined(__has_include)
+# define __has_include(x) 0
+#endif
+#if !defined(__has_attribute)
+# define __has_attribute(x) 0
+#endif
+#if !defined(__has_feature)
+# define __has_feature(x) 0
+#endif
+#if !defined(__has_warning)
+# define __has_warning(x) 0
+#endif
+
+#if __has_include(<swift/objc-prologue.h>)
+# include <swift/objc-prologue.h>
+#endif
+
+#pragma clang diagnostic ignored "-Wauto-import"
+#if defined(__OBJC__)
+#include <Foundation/Foundation.h>
+#endif
+#if defined(__cplusplus)
+#include <cstdint>
+#include <cstddef>
+#include <cstdbool>
+#include <cstring>
+#include <stdlib.h>
+#include <new>
+#include <type_traits>
+#else
+#include <stdint.h>
+#include <stddef.h>
+#include <stdbool.h>
+#include <string.h>
+#endif
+#if defined(__cplusplus)
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
+#if defined(__arm64e__) && __has_include(<ptrauth.h>)
+# include <ptrauth.h>
+#else
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wreserved-macro-identifier"
+# ifndef __ptrauth_swift_value_witness_function_pointer
+# define __ptrauth_swift_value_witness_function_pointer(x)
+# endif
+# ifndef __ptrauth_swift_class_method_pointer
+# define __ptrauth_swift_class_method_pointer(x)
+# endif
+#pragma clang diagnostic pop
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#if !defined(SWIFT_TYPEDEFS)
+# define SWIFT_TYPEDEFS 1
+# if __has_include(<uchar.h>)
+# include <uchar.h>
+# elif !defined(__cplusplus)
+typedef uint_least16_t char16_t;
+typedef uint_least32_t char32_t;
+# endif
+typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
+typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
+typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
+typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
+typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
+typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
+typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
+typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
+typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
+typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
+typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
+typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
+#endif
+
+#if !defined(SWIFT_PASTE)
+# define SWIFT_PASTE_HELPER(x, y) x##y
+# define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
+#endif
+#if !defined(SWIFT_METATYPE)
+# define SWIFT_METATYPE(X) Class
+#endif
+#if !defined(SWIFT_CLASS_PROPERTY)
+# if __has_feature(objc_class_property)
+# define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
+# else
+# define SWIFT_CLASS_PROPERTY(...)
+# endif
+#endif
+#if !defined(SWIFT_RUNTIME_NAME)
+# if __has_attribute(objc_runtime_name)
+# define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
+# else
+# define SWIFT_RUNTIME_NAME(X)
+# endif
+#endif
+#if !defined(SWIFT_COMPILE_NAME)
+# if __has_attribute(swift_name)
+# define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
+# else
+# define SWIFT_COMPILE_NAME(X)
+# endif
+#endif
+#if !defined(SWIFT_METHOD_FAMILY)
+# if __has_attribute(objc_method_family)
+# define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
+# else
+# define SWIFT_METHOD_FAMILY(X)
+# endif
+#endif
+#if !defined(SWIFT_NOESCAPE)
+# if __has_attribute(noescape)
+# define SWIFT_NOESCAPE __attribute__((noescape))
+# else
+# define SWIFT_NOESCAPE
+# endif
+#endif
+#if !defined(SWIFT_RELEASES_ARGUMENT)
+# if __has_attribute(ns_consumed)
+# define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
+# else
+# define SWIFT_RELEASES_ARGUMENT
+# endif
+#endif
+#if !defined(SWIFT_WARN_UNUSED_RESULT)
+# if __has_attribute(warn_unused_result)
+# define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+# else
+# define SWIFT_WARN_UNUSED_RESULT
+# endif
+#endif
+#if !defined(SWIFT_NORETURN)
+# if __has_attribute(noreturn)
+# define SWIFT_NORETURN __attribute__((noreturn))
+# else
+# define SWIFT_NORETURN
+# endif
+#endif
+#if !defined(SWIFT_CLASS_EXTRA)
+# define SWIFT_CLASS_EXTRA
+#endif
+#if !defined(SWIFT_PROTOCOL_EXTRA)
+# define SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_ENUM_EXTRA)
+# define SWIFT_ENUM_EXTRA
+#endif
+#if !defined(SWIFT_CLASS)
+# if __has_attribute(objc_subclassing_restricted)
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# else
+# define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
+# endif
+#endif
+#if !defined(SWIFT_RESILIENT_CLASS)
+# if __has_attribute(objc_class_stub)
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# else
+# define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
+# define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
+# endif
+#endif
+#if !defined(SWIFT_PROTOCOL)
+# define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+# define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
+#endif
+#if !defined(SWIFT_EXTENSION)
+# define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
+#endif
+#if !defined(OBJC_DESIGNATED_INITIALIZER)
+# if __has_attribute(objc_designated_initializer)
+# define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
+# else
+# define OBJC_DESIGNATED_INITIALIZER
+# endif
+#endif
+#if !defined(SWIFT_ENUM_ATTR)
+# if __has_attribute(enum_extensibility)
+# define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
+# else
+# define SWIFT_ENUM_ATTR(_extensibility)
+# endif
+#endif
+#if !defined(SWIFT_ENUM)
+# define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# if __has_feature(generalized_swift_name)
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
+# else
+# define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
+# endif
+#endif
+#if !defined(SWIFT_UNAVAILABLE)
+# define SWIFT_UNAVAILABLE __attribute__((unavailable))
+#endif
+#if !defined(SWIFT_UNAVAILABLE_MSG)
+# define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
+#endif
+#if !defined(SWIFT_AVAILABILITY)
+# define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
+#endif
+#if !defined(SWIFT_WEAK_IMPORT)
+# define SWIFT_WEAK_IMPORT __attribute__((weak_import))
+#endif
+#if !defined(SWIFT_DEPRECATED)
+# define SWIFT_DEPRECATED __attribute__((deprecated))
+#endif
+#if !defined(SWIFT_DEPRECATED_MSG)
+# define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
+#endif
+#if !defined(SWIFT_DEPRECATED_OBJC)
+# if __has_feature(attribute_diagnose_if_objc)
+# define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
+# else
+# define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
+# endif
+#endif
+#if defined(__OBJC__)
+#if !defined(IBSegueAction)
+# define IBSegueAction
+#endif
+#endif
+#if !defined(SWIFT_EXTERN)
+# if defined(__cplusplus)
+# define SWIFT_EXTERN extern "C"
+# else
+# define SWIFT_EXTERN extern
+# endif
+#endif
+#if !defined(SWIFT_CALL)
+# define SWIFT_CALL __attribute__((swiftcall))
+#endif
+#if !defined(SWIFT_INDIRECT_RESULT)
+# define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result))
+#endif
+#if !defined(SWIFT_CONTEXT)
+# define SWIFT_CONTEXT __attribute__((swift_context))
+#endif
+#if !defined(SWIFT_ERROR_RESULT)
+# define SWIFT_ERROR_RESULT __attribute__((swift_error_result))
+#endif
+#if defined(__cplusplus)
+# define SWIFT_NOEXCEPT noexcept
+#else
+# define SWIFT_NOEXCEPT
+#endif
+#if !defined(SWIFT_C_INLINE_THUNK)
+# if __has_attribute(always_inline)
+# if __has_attribute(nodebug)
+# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug))
+# else
+# define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline))
+# endif
+# else
+# define SWIFT_C_INLINE_THUNK inline
+# endif
+#endif
+#if defined(_WIN32)
+#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
+# define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport)
+#endif
+#else
+#if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
+# define SWIFT_IMPORT_STDLIB_SYMBOL
+#endif
+#endif
+#if defined(__OBJC__)
+#if __has_feature(objc_modules)
+#if __has_warning("-Watimport-in-framework-header")
+#pragma clang diagnostic ignored "-Watimport-in-framework-header"
+#endif
+#endif
+
+#endif
+#pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
+#pragma clang diagnostic ignored "-Wduplicate-method-arg"
+#if __has_warning("-Wpragma-clang-attribute")
+# pragma clang diagnostic ignored "-Wpragma-clang-attribute"
+#endif
+#pragma clang diagnostic ignored "-Wunknown-pragmas"
+#pragma clang diagnostic ignored "-Wnullability"
+#pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
+#pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
+
+#if __has_attribute(external_source_symbol)
+# pragma push_macro("any")
+# undef any
+# pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="JoyGemAI",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
+# pragma pop_macro("any")
+#endif
+
+#if defined(__OBJC__)
+#endif
+#if __has_attribute(external_source_symbol)
+# pragma clang attribute pop
+#endif
+#if defined(__cplusplus)
+#endif
+#pragma clang diagnostic pop
+#endif
+
+#else
+#error unsupported Swift architecture
+#endif
--- /dev/null
+//
+// JoyGemAI.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+//! Project version number for JoyGemAI.
+FOUNDATION_EXPORT double JoyGemAIVersionNumber;
+
+//! Project version string for JoyGemAI.
+FOUNDATION_EXPORT const unsigned char JoyGemAIVersionString[];
+
+// In this header, you should import all the public headers of your framework using statements like #import <JoyGemAI/PublicHeader.h>
+
+#import <JoyGemAI/JoyGemAIManager.h>
+#import <JoyGemAI/JoyGemParam.h>
+#import <JoyGemAI/JoyGemModel.h>
+#import <JoyGemAI/JoyGemChatManager.h>
+#import <JoyGemAI/JoyGemSIManager.h>
+#import <JoyGemAI/JoyGemSIDeviceManager.h>
+#import <JoyGemAI/JoyGemRecordManager.h>
+#import <JoyGemAI/JoyGemCallManager.h>
+#import <JoyGemAI/JoyGemEnum.h>
+#import <JoyGemAI/JoyGemDeviceManager.h>
--- /dev/null
+//
+// JoyGemAIManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+#import <CoreBluetooth/CoreBluetooth.h>
+#import <JoyGemAI/JoyGemParam.h>
+#import <JoyGemAI/JoyGemModel.h>
+#import <JoyGemAI/JoyGemEnum.h>
+#import <SocketRocket/SocketRocket.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol JoyGemAIManagerDelegate <NSObject>
+
+/// 鉴权成功时回调
+-(void)joyGemAuthSuccessCallback;
+
+/// 鉴权失败时回调
+-(void)joyGemAuthFailedCallback;
+
+/// AI\b耳机动作回调
+/// - NOTE: 对话相关动作是通知,即消息来时已经发生,录音相关动作是请求,即耳机没有实际操作
+@optional
+-(void)joyGemAction:(JoyGemActionMode)action;
+
+@end
+
+@protocol JoyGemAIManagerDataSource <NSObject>
+
+///实现该方法,将数据转发给蓝牙
+@required
+-(void)joyGemSendData:(NSData*)data withCharacteristic:(CBCharacteristic*)characteristic;
+
+@end
+
+@class JoyGemDeviceManager;
+
+@interface JoyGemAIManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemAIManagerDelegate> delegate;
+@property(nonatomic, weak) id<JoyGemAIManagerDataSource> dataSource;
+
+@property(nonatomic, strong) JoyGemDeviceManager *device;
+
+// 实例对象
++ (instancetype)shared;
+
+/// 初始化sdk
+- (void)initSdk;
+
+/// 日志打印级别
+/// - Parameter level: 日志等级 分为关闭,简略,完全
+- (void)setLogMode:(JoyGemLogMode)mode;
+
+/// 日志存储路径
+/// - Parameter path: 日志存储文件路径
+/// - Description: 为空时不进行日志存储, 不支持多次配置
+- (void)setLogPath:(nullable NSString*)path;
+
+/// 传入蓝牙服务对象
+/// - Parameters:
+/// - service: 服务对象
+/// - characteristics: 需要\bnotify的特征
+/// - Returns: 是否正确的配置了相关服务特征
+/// - Description: Block为同步操作
+- (BOOL)configService:(CBService*)service needNotify:(void (^)(NSArray<CBCharacteristic*>*))characteristics;
+
+/// 收到蓝牙设备传过来的数据,调用此方法交给sdk处理
+/// - Parameter characteristic:更新的特征
+- (void)receiveValue:(CBCharacteristic *)characteristic;
+
+/// 蓝牙设备已连接
+- (void)bleConnected;
+
+/// 蓝牙断开连接
+- (void)bleDisConnected;
+
+/// SDK文件存储文件夹
+/// - Parameter path: SDK文件存储路径(SDK需要用到文件存储时所指向的路径)
+- (void)setCacheDirectory:(nullable NSString*)path;
+
+/// 清除临时文件
+/// - Description: 只会清除当前配置路径下的文件
+- (void)clearCacheDirectory;
+
+/// \bTWS耳机主从切换时是否尝试当前AI功能自动延续
+/// - Parameters:
+/// - enable: 默认为false
+-(void)setTWSAutoSync:(BOOL)enable;
+
+-(void)setTextAutoSync:(BOOL)enable;
+
+-(void)setEmotionAutoSync:(BOOL)enable;
+
+/// 文本翻译
+/// - Parameters:
+/// - text: 翻译的文字
+/// - fromLanguage: 原始语言
+/// - toLanguage: 翻译语言
+/// - stream: 结果回调
+/// - error: 错误回调
+/// - Description: 最大文本支持30K
+- (void)translate:(NSString *)text from:(NSString*)fromLanguage to:(NSString*)toLanguage stream:(void (^)(NSString* llmResponse,BOOL finish))stream error:(void (^)( NSError * _Nullable err))error;
+
+/// 取消文本翻译
+-(void)cancelTranslateRequest;
+
+/// 文本摘要
+/// - Parameters:
+/// - text: 摘要的文字
+/// - stream: 结果回调
+/// - error: 错误回调
+/// - Description: 最大文本支持30K
+- (void)summary:(NSString *)text stream:(void (^)(NSString* llmResponse,BOOL finish))stream error:(void (^)( NSError * _Nullable err))error;
+
+/// 取消文本摘要
+-(void)cancelSummaryRequest;
+
+
+/// 设置同传的tts回应速度
+/// - Parameters:
+/// - speed: 默认1.0,范围[0.8,2]
+-(void)setTtsSpeed:(float)speed;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemCallController.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/7/12.
+//
+
+#import <UIKit/UIKit.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemCallManager;
+@class JoyGemAsrModel;
+
+//通话录音的委托类
+@protocol JoyGemCallManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@optional
+-(void)callManager:(JoyGemCallManager*)manager didUpdateAsr:(JoyGemAsrModel*)model DEPRECATED_MSG_ATTRIBUTE("Use callManager:didUpdateMonoAsr instead \bif supportStereo is false");;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)callManager:(JoyGemCallManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)callManager:(JoyGemCallManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)callManager:(JoyGemCallManager*)manager onError:(JoyGemErrorCode)code;
+
+/// 通话录音开启时,不处于通话状态
+/// - Description: 需要确认耳机是否支持该判断,如果耳机不支持将不会收到回调
+@optional
+-(void)callManagerNotonCall:(JoyGemCallManager*)manager;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)callManagerStopped:(JoyGemCallManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)callManagerCompleted:(JoyGemCallManager*)manager;
+
+@end
+
+@protocol JoyGemCallMonoDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)callManager:(JoyGemCallManager*)manager didUpdateMonoAsr:(JoyGemAsrModel*)model;
+
+@end
+
+@protocol JoyGemCallStereoDelegate <NSObject>
+
+///录音文字识别
+/// - Parameters:
+/// - model: asr识别的对象
+/// - index: 声道序号 1,2
+@required
+-(void)callManager:(JoyGemCallManager*)manager didUpdateStereoAsr:(JoyGemAsrModel*)model channel:(NSUInteger)index;
+
+
+@end
+
+
+/// 通话录音的管理类
+@interface JoyGemCallManager : NSObject
+
+/// 委托类
+/// - Description: 通话录音状态委托
+@property(nonatomic, weak) id<JoyGemCallManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 是否正在录音
+@property(nonatomic, assign) BOOL isRecording;
+
+/// 是否支持立体声录音
+/// - NOTE:鉴权后再使用该字段
+@property(nonatomic, assign ,readonly) BOOL supportStereo;
+
+/// 单声道委托
+/// - Description: 固件支持单声道通话录音时会通过此委托进行回调
+@property(nonatomic, weak) id<JoyGemCallMonoDelegate> monoDelegate;
+
+/// 立体声委托
+/// - Description: 固件支持双声道通话录音时会通过此委托进行回调
+@property(nonatomic, weak) id<JoyGemCallStereoDelegate> stereoDelegate;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开始通话录音
+- (void)start;
+
+/// 结束通话录音
+- (void)stop;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemChatManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+@class JoyGemChatManager;
+@class JoyGemSpeaker;
+
+
+NS_ASSUME_NONNULL_BEGIN
+
+@protocol JoyGemChatManagerDelegate <NSObject>
+
+///AI语音接收
+/// - Parameters:
+/// - data: 音频数据 pcm格式
+-(void)chatManager:(JoyGemChatManager*)manager audioData:(nullable NSData*)data finish:(BOOL)isFinish;
+
+///用户语音识别
+/// - Parameters:
+/// - text: 文字数据
+/// - index: 语句ID
+-(void)chatManager:(JoyGemChatManager*)manager requestText:(nullable NSString*)text index:(NSUInteger)index;
+
+///AI语音识别
+/// - Parameters:
+/// - text: 文字数据
+/// - index: 语句ID
+/// - isFinish\b:单次对话结束
+-(void)chatManager:(JoyGemChatManager*)manager responseText:(nullable NSString*)text index:(NSUInteger)index finish:(BOOL)isFinish;
+
+///对话状态回调
+/// - Parameters:
+/// - code: 状态变化
+@optional
+-(void)chatManager:(JoyGemChatManager*)manager stateChange:(JoyGemStateCode)code DEPRECATED_MSG_ATTRIBUTE("Use chatManager:eventUpdate instead");
+
+///对话事件回调
+/// - Parameters:
+/// - event: 对话相关事件回调
+/// - NOTE: 需要相关固件支持
+@optional
+-(void)chatManager:(JoyGemChatManager*)manager eventUpdate:(JoyGemChatEvent)event;
+
+/// 错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)chatManager:(JoyGemChatManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+//AI对话的管理类
+@interface JoyGemChatManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemChatManagerDelegate> delegate;
+
+//是否正在对话录音中
+@property(nonatomic, assign) BOOL isRecording;
+
+///是否正在活跃中
+/// - NOTE:可以采用KVO的方式监听该对象, 单次对话不会造成该状态改变
+@property(atomic, assign) BOOL isActive DEPRECATED_MSG_ATTRIBUTE("Use chatManager:eventUpdate instead \bif supportEvent is\b true");
+
+///是否支持事件上报模式
+/// - NOTE:鉴权后再使用该字段
+@property(nonatomic,assign,readonly) BOOL supportEvent;
+
+// 实例对象
++ (instancetype)shared;
+
+/// 开启单次对话
+/// - Note: 如正在播报,需要提前关闭tts后再调用,否则开启无效
+/// - TODO: 待容错处理
+- (void)startSingleChat;
+
+/// 结束单次对话
+/// - Note:请勿在开启单次对话后立刻调用该方法,否则耳机可能不会处理该次请求
+/// - TODO: 待容错处理
+- (void)stopSingleChat;
+
+/// 开启连续对话
+- (void)startChat;
+
+/// 结束连续对话
+- (void)stopChat;
+
+/// 播放音频开始前需要调用此方法告诉耳机
+- (void)playAudioStart;
+
+/// 播放音频结束时需要调用此方法告诉耳机
+/// - Description: 如果处于连续对话状态,则在调用该方法后会直接开启下一轮对话
+- (void)playAudioEnd;
+
+///获取支持角色列表
+/// - Parameters:
+/// - list: 角色列表
+-(void)getSpeakerList:(void (^)(NSArray<JoyGemSpeaker *>*))list;
+
+///配置当前角色
+-(void)setSpeaker:(JoyGemSpeaker*)speaker;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemDeviceManager.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/9/1.
+//
+
+#import <Foundation/Foundation.h>
+#import "JoyGemEnum.h"
+#import "JoyGemModel.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface JoyGemDeviceManager : NSObject
+
+@property(nonatomic,assign) BOOL twsStatus;
+
+/// 获取mac地址
+/// - Returns:
+/// - edrAddress: 经典蓝牙地址
+/// - bleAddress: ble蓝牙地址
+-(void)macAddress:(void (^)(NSString* edrAddress,NSString* bleAddress))address error:(void (^)( NSError * _Nullable err))error;
+
+/// 获取软件版本
+/// - Returns:
+/// - version: 软件版本
+-(void)software:(void (^)(NSString* version))infomation error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 设置电量监听
+/// - Parameters:
+/// - left: 左耳电量
+/// - right: 右耳电量
+/// - Description: 电量范围为0~100,当未获取到电量时,电量为-1,配置回调时,如果有历史数据,会返回最后的历史数据,耳机会在电量变更时主动上报数据
+-(void)setBatteryListener:(void (^)(NSInteger left, NSInteger right))batteryListener;
+
+/// 主动获取电量
+-(void)updateBattery;
+
+/// 设置耳机状态监听
+/// - Parameters:
+/// - btConnected: 经典蓝牙连接状态
+/// - twsConnected : 双耳模式连接状态
+/// - Description: 部分设置需要在双耳模式下才能生效
+-(void)setStatusListener:(void (^)(BOOL btConnected,BOOL twsConnected))statusListener;
+
+/// 主动获取耳机状态
+-(void)updateStatus;
+
+/// 设置VAD打断状态
+/// - Parameters:
+/// - isOpen: VAD打断是否开启
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setVADInterruptedStatus:(BOOL)isOpen callback:(void (^)( NSError * _Nullable err))error;
+
+/// 获取VAD打断状态
+/// - Returns:
+/// - status: VAD打断是否开启
+-(void)getVADInterruptedStatus:(void (^)(BOOL isOpen))status error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 设置EQ模式
+/// - Parameters:
+/// - mode: \bEQ模式
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setEQMode:(JoyGemEQMode)mode callback:(void (^)( NSError * _Nullable err))error;
+
+/// 获取EQ模式
+/// - Returns:
+/// - mode: VAD打断是否开启
+-(void)getEQMode:(void (^)(JoyGemEQMode mode))mode error:(void (^)( NSError * _Nullable err))error;
+
+/// 设置自定义EQ
+/// - Parameters:
+/// - index: 频段 范围为0~9
+/// - gain: 增益 范围为 -12~12
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)setCustomEQ:(NSUInteger)index withGain:(NSInteger)gain callback:(void (^)( NSError * _Nullable err))error;
+
+/// 重置自定义EQ
+/// - Description: 该设置必须在双耳模式下才能生效,否则返回失败
+-(void)resetCustomEQ:(void (^)( NSError * _Nullable err))error;
+
+/// 获取自定义EQ
+/// - Returns:
+/// - custom: 自定义EQ类型
+-(void)getCustomEQ:(void (^)(JoyGemCustomEQ*))custom error:(void (^)( NSError * _Nullable err))error;
+
+
+/// 查找耳机
+/// - Parameters:
+/// - mode: 查找耳机命令类型
+-(void)findHeadphone:(JoyGemFindHeadphoneMode)mode callback:(void (^)( NSError * _Nullable err))error;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemAIEnum.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#ifndef JoyGemAIEnum_h
+#define JoyGemAIEnum_h
+
+/// 状态变化
+typedef NS_OPTIONS(NSInteger,JoyGemStateCode) {
+ JoyGemStateCodeStartRecord = 1001,///开始录音
+ JoyGemStateCodeStopRecord = 1002,///停止录音
+ JoyGemStateCodeWebsocketConnected = 3001,///socket连上
+ JoyGemStateCodeWebsocketDisconnected = 3002,///socket断开连接
+};
+
+/// 错误
+typedef NS_OPTIONS(NSInteger,JoyGemErrorCode) {
+ JoyGemErrorCodeRecordError = 1003,///录音出错
+ JoyGemErrorCodeNetError = 3003,///网络错误
+ JoyGemErrorCodeUnAuth = 9999,///未鉴权
+};
+
+/// 录音类型
+typedef NS_ENUM(NSUInteger, JoyGemRecordMode) {
+ JoyGemRecordModeLive = 1, ///现场录音
+ JoyGemRecordModeCall = 2, ///通话录音
+};
+
+/// 日志类型
+typedef NS_ENUM(NSUInteger, JoyGemLogMode) {
+ JoyGemLogModeClose, ///关闭日志
+ JoyGemLogModeSimple, ///简略日志
+ JoyGemLogModeAll, ///完整日志
+};
+
+/// 动作类型
+typedef NS_ENUM(NSUInteger, JoyGemActionMode) {
+ JoyGemActionModeCancel = 0, ///关闭当前AI功能
+ JoyGemActionModeRecordLive = 1, ///现场录音
+ JoyGemActionModeRecordCall = 2, ///通话录音
+ JoyGemActionModeSi = 3, ///同声传译
+ JoyGemActionModeChat = 4, ///AI对话
+};
+
+/// 录音结束类型
+typedef NS_ENUM(NSUInteger, JoyGemRecordStopCode) {
+ JoyGemRecordStopCodeActively = 0, ///用户主动关闭录音
+ JoyGemRecordStopCodePassively = 1, ///用户被动关闭录音
+};
+
+
+/// 对话事件类型
+typedef NS_ENUM(NSUInteger, JoyGemChatEvent) {
+ JoyGemChatEventIdle = 0, /// 空闲中
+ JoyGemChatEventBegin, /// 开始对话(单轮对话不会产生该事件)
+ JoyGemChatEventEnd, /// 结束对话(单轮对话不会产生该事件)
+ JoyGemChatEventNewRound, /// 开始新一轮对话
+ JoyGemChatEventRecording, /// 录音中
+ JoyGemChatEventRspWaiting, /// 等待中
+ JoyGemChatEventPlaying, /// 正在播放声音
+ JoyGemChatEventPlayEnd, /// 结束播放声音
+};
+
+/// EQ类型
+typedef NS_ENUM(NSUInteger, JoyGemEQMode) {
+ JoyGemEQModeNormal, ///普通
+ JoyGemEQModeRock, ///摇滚
+ JoyGemEQModePop, ///流行
+ JoyGemEQModeClassic, ///经典
+ JoyGemEQModeJazz, ///爵士
+ JoyGemEQModeCustom, ///自定义
+};
+
+
+/// EQ类型
+typedef NS_ENUM(NSUInteger, JoyGemFindHeadphoneMode) {
+ JoyGemFindHeadphoneModeCancel, ///关闭查找耳机
+ JoyGemFindHeadphoneModeLeft, ///查找左耳
+ JoyGemFindHeadphoneModeRight, ///查找右耳
+ JoyGemFindHeadphoneModeAll, ///查找双耳
+};
+
+#endif /* JoyGemAIEnum_h */
--- /dev/null
+//
+// JoyGemAIModel.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+///AI对话角色
+@interface JoyGemSpeaker : NSObject
+
+@property (nonatomic, strong) NSString *sid;/// 音色id
+@property (nonatomic, strong) NSString *name;/// 名称
+@property (nonatomic, strong) NSString *type;/// 类型
+@property (nonatomic, strong) NSString *role;/// 角色
+
+@end
+
+
+///ASR对象
+@interface JoyGemAsrModel : NSObject
+
+@property (nonatomic, strong) NSString *text; /// 文本
+@property (nonatomic, assign) NSUInteger index; /// 序号
+@property (nonatomic, assign) BOOL definite; /// 片段化确定(不建议作为断句标识)
+
+@end
+
+///自定义EQ设置对象
+@interface JoyGemCustomEQ : NSObject
+
+@property (nonatomic, strong) NSArray<NSNumber*> *bands;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemAIParam.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+///MARK: 语音语言
+
+//自动识别中英
+extern NSString* const kJoyGemAILocalizationAuto;
+
+//简体中文 zh-CN
+extern NSString* const kJoyGemAILocalizationZH;
+
+//英文 en-US
+extern NSString* const kJoyGemAILocalizationEN;
+
+//日语 ja-JP
+extern NSString* const kJoyGemAILocalizationJA;
+
+//韩语 ko-KR
+extern NSString* const kJoyGemAILocalizationKO;
+
+//法语 fr-FR
+extern NSString* const kJoyGemAILocalizationFR;
+
+//西班牙语 es-MX
+extern NSString* const kJoyGemAILocalizationES;
+
+//葡萄牙语 pt-BR
+extern NSString* const kJoyGemAILocalizationPT;
+
+//印尼语 id-ID
+extern NSString* const kJoyGemAILocalizationID;
+
+//俄语 ru-RU
+extern NSString* const kJoyGemAILocalizationRU;
+
+//马来语 ms-MY
+extern NSString* const kJoyGemAILocalizationMS;
+
+///MARK: 蓝牙相关
+///
+///AI功能使用的蓝牙服务
+extern NSString* const kJoyGemAIServiceUUID;
+
+extern NSString* const kJoyGemAICharacteristicNotifyUUID;
+
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemRecordManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemRecordManager;
+@class JoyGemAsrModel;
+
+//现场录音的委托类
+@protocol JoyGemRecordManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)recordManager:(JoyGemRecordManager*)manager didUpdateAsr:(JoyGemAsrModel*)model;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)recordManager:(JoyGemRecordManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)recordManager:(JoyGemRecordManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)recordManager:(JoyGemRecordManager*)manager onError:(JoyGemErrorCode)code;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)recordManagerStopped:(JoyGemRecordManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应,
+@optional
+-(void)recordManagerCompleted:(JoyGemRecordManager*)manager;
+
+@end
+
+/// 现场录音的管理类
+@interface JoyGemRecordManager : NSObject
+
+/// 委托类
+@property(nonatomic, weak) id<JoyGemRecordManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 是否正在暂停中
+@property(nonatomic,assign) BOOL isPause;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开启现场录音
+- (void)start;
+
+/// 结束现场录音
+- (void)stop;
+
+/// 暂停录音
+- (void)pause;
+
+/// 恢复录音
+- (void)resume;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemSIDeviceManager.h
+// JoyGemAI
+//
+// Created by jjjs on 2025/5/21.
+//
+
+#import <UIKit/UIKit.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class JoyGemSIDeviceManager;
+@class JoyGemAsrModel;
+
+/// 同声传译(设备)的管理类
+@protocol JoyGemSIDeviceManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateRaw:(JoyGemAsrModel*)model;
+
+///录音文字翻译时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateTranslate:(JoyGemAsrModel*)model;
+
+///音频数据更新时
+/// - Parameters:
+/// - data: 流数据 pcm格式
+@required
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager didUpdateAudioData:(NSData*)data;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)siDeviceManagerStopped:(JoyGemSIDeviceManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)siDeviceManagerCompleted:(JoyGemSIDeviceManager*)manager;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager saveFile:(NSString*)path;
+
+///录音状态回调
+/// - Parameters:
+/// - code: 状态变化
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager stateChange:(JoyGemStateCode)code;
+
+/// 录音错误回调
+/// - Parameters:
+/// - mode:错误代码
+-(void)siDeviceManager:(JoyGemSIDeviceManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+/// 同声传译(设备)的管理类
+@interface JoyGemSIDeviceManager : NSObject
+
+/// 委托类
+@property(nonatomic, weak) id<JoyGemSIDeviceManagerDelegate> delegate;
+
+/// 耳机识别语言
+@property(nonatomic, strong) NSString* originalLanguage;
+
+/// 耳机输出语言
+@property(nonatomic, strong) NSString* targetLanguage;
+
+/// 是否正在录音
+@property(nonatomic,assign) BOOL isRecording;
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开始同声传译(设备)
+- (void)start;
+
+/// 结束同声传译(设备)
+- (void)stop;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// JoyGemSIManager.h
+// JoyGemAI
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+#import <Foundation/Foundation.h>
+#import <JoyGemAI/JoyGemEnum.h>
+
+@class JoyGemSIManager;
+@class JoyGemAsrModel;
+
+NS_ASSUME_NONNULL_BEGIN
+
+//同声传译的委托类
+@protocol JoyGemSIManagerDelegate <NSObject>
+
+///录音文字识别时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateRaw:(JoyGemAsrModel*)model;
+
+///录音文字翻译时
+/// - Parameters:
+/// - model: asr识别的对象
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateTranslate:(JoyGemAsrModel*)model;
+
+///音频数据更新时
+/// - Parameters:
+/// - data: 流数据 pcm格式
+@required
+-(void)siManager:(JoyGemSIManager*)manager didUpdateAudioData:(NSData*)data;
+
+///录音状态切换时
+-(void)siManager:(JoyGemSIManager*)manager stateChange:(JoyGemStateCode)code;
+
+///结束时的回调
+/// - Parameters:
+/// - code: 录音结束的原因
+-(void)siManagerStopped:(JoyGemSIManager*)manager reason:(JoyGemRecordStopCode)code;
+
+/// 录音完成时的回调
+/// - Description: 录音任务调用结束后,会在服务器所有响应结束后进行回调
+/// - Note: 该接口仅在任务成功完成时才会进行回调,并不保证和stop方法实现一一对应
+@optional
+-(void)siManagerCompleted:(JoyGemSIManager*)manager;
+
+///文件生成后的回调
+/// - Parameters:
+/// - path: 文件存储路径 wav格式
+-(void)siManager:(JoyGemSIManager*)manager saveFile:(NSString*)path;
+
+/// 错误回调
+-(void)siManager:(JoyGemSIManager*)manager onError:(JoyGemErrorCode)code;
+
+@end
+
+/// 同声传译的管理类
+@interface JoyGemSIManager : NSObject
+
+@property(nonatomic, weak) id<JoyGemSIManagerDelegate> delegate;
+
+///原始语言
+///目前原始语言设置无效,默认为kJoyGemAILocalizationAuto
+@property(nonatomic, strong) NSString* originalLanguage;
+
+///目标语言
+///默认为kJoyGemAILocalizationAuto,可以设置为中文或者英文
+@property(nonatomic, strong) NSString* targetLanguage;
+
+/// 是否正在录音
+@property(nonatomic,assign) BOOL isRecording;
+
+
+/// 实例对象
++ (instancetype)shared;
+
+/// 开启同声传译
+- (void)start;
+
+/// 结束同声传译
+- (void)stop;
+
+
+@end
+
+NS_ASSUME_NONNULL_END
+
--- /dev/null
+{
+ "ABIRoot": {
+ "kind": "Root",
+ "name": "JoyGemAI",
+ "printedName": "JoyGemAI",
+ "children": [
+ {
+ "kind": "Import",
+ "name": "Foundation",
+ "printedName": "Foundation",
+ "declKind": "Import",
+ "moduleName": "JoyGemAI",
+ "declAttributes": [
+ "RawDocComment"
+ ]
+ }
+ ],
+ "json_format_version": 8
+ },
+ "ConstValues": []
+}
\ No newline at end of file
--- /dev/null
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+// swift-module-flags: -target arm64-apple-ios13.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name JoyGemAI
+// swift-module-flags-ignorable: -no-verify-emitted-module-interface
+import Foundation
+@_exported import JoyGemAI
+import Swift
+import _Concurrency
+import _StringProcessing
+import _SwiftConcurrencyShims
--- /dev/null
+// swift-interface-format-version: 1.0
+// swift-compiler-version: Apple Swift version 6.0.2 effective-5.10 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
+// swift-module-flags: -target arm64-apple-ios13.0 -enable-objc-interop -enable-library-evolution -swift-version 5 -enforce-exclusivity=checked -O -enable-bare-slash-regex -module-name JoyGemAI
+// swift-module-flags-ignorable: -no-verify-emitted-module-interface
+import Foundation
+@_exported import JoyGemAI
+import Swift
+import _Concurrency
+import _StringProcessing
+import _SwiftConcurrencyShims
--- /dev/null
+framework module JoyGemAI {
+ umbrella header "JoyGemAI.h"
+ export *
+
+ module * { export * }
+}
+
+module JoyGemAI.Swift {
+ header "JoyGemAI-Swift.h"
+ requires objc
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSPrivacyTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypes</key>
+ <array>
+ <dict>
+ <key>NSPrivacyCollectedDataType</key>
+ <string>NSPrivacyCollectedDataTypeAudioData</string>
+ <key>NSPrivacyCollectedDataTypeLinked</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypeTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypePurposes</key>
+ <array>
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
+ </array>
+ </dict>
+ </array>
+ <key>NSPrivacyTrackingDomains</key>
+ <array/>
+ <key>NSPrivacyAccessedAPITypes</key>
+ <array/>
+</dict>
+</plist>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>files</key>
+ <dict>
+ <key>Headers/JoyGemAI-Swift.h</key>
+ <data>
+ EzwLstWsXu+VfPMQanIZDbX3a0E=
+ </data>
+ <key>Headers/JoyGemAI.h</key>
+ <data>
+ 8NnRIJGe/ATf7a6jdPAfly29UC4=
+ </data>
+ <key>Headers/JoyGemAIManager.h</key>
+ <data>
+ Oq+OIkczOsgav5Qo1BqTz/1gc4M=
+ </data>
+ <key>Headers/JoyGemCallManager.h</key>
+ <data>
+ BWJeSQyHYVE1TwiSgvXYhNdyJXI=
+ </data>
+ <key>Headers/JoyGemChatManager.h</key>
+ <data>
+ EOl/+6HcGPZVHgre1chnDptuCBU=
+ </data>
+ <key>Headers/JoyGemDeviceManager.h</key>
+ <data>
+ h7T4t0GUmAg2ZHyPU+Sn7lQrkw0=
+ </data>
+ <key>Headers/JoyGemEnum.h</key>
+ <data>
+ M1/juV+sL7ggbp4Y9srW0rq/Dqo=
+ </data>
+ <key>Headers/JoyGemModel.h</key>
+ <data>
+ ZQ5Ie1ErW3QF78XXxz/ydxsSQ5E=
+ </data>
+ <key>Headers/JoyGemParam.h</key>
+ <data>
+ SzxTsmYo/XvsD3Uz2iqjnRDkRnA=
+ </data>
+ <key>Headers/JoyGemRecordManager.h</key>
+ <data>
+ pKeMD6Xg3Br6ZOWB/BxyqAicCfc=
+ </data>
+ <key>Headers/JoyGemSIDeviceManager.h</key>
+ <data>
+ Cn0/thrZRr+pJ+skbuRbfJJirmA=
+ </data>
+ <key>Headers/JoyGemSIManager.h</key>
+ <data>
+ UiwORLtCgzF+QX/hXpK2w63Yx4Q=
+ </data>
+ <key>Info.plist</key>
+ <data>
+ vHVrQqK4ReuQBxyUxqv5BOG8mbw=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
+ <data>
+ jacBwduET4BLcaiJtoJ9sWWXQ6s=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.abi.json</key>
+ <data>
+ iVs2bUNJJDbD/ENi/Q0lo4aP3uk=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
+ <data>
+ BmjRZIKCen7GN8lmcoDVw3R2KvM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftdoc</key>
+ <data>
+ xFskxbeAbkxTqKE8F2wcvY/ElFM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftinterface</key>
+ <data>
+ BmjRZIKCen7GN8lmcoDVw3R2KvM=
+ </data>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftmodule</key>
+ <data>
+ 4QozN8a+2xPGGnyDrUz/2Hg7JPI=
+ </data>
+ <key>Modules/module.modulemap</key>
+ <data>
+ qguEoXSNM0mFX+7WmMXUO3TTSLk=
+ </data>
+ <key>PrivacyInfo.xcprivacy</key>
+ <data>
+ SRctDO3cqibONLEG7CPcNZVBnXw=
+ </data>
+ </dict>
+ <key>files2</key>
+ <dict>
+ <key>Headers/JoyGemAI-Swift.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ D6FOg3LxVu6AQ3xMxdtxm8TsqeXBLCKYS1SQ1weJXno=
+ </data>
+ </dict>
+ <key>Headers/JoyGemAI.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ nO8YFPNcoOIKUrpS9Pd4/T9V98f16ACbB7LFROxEPhQ=
+ </data>
+ </dict>
+ <key>Headers/JoyGemAIManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ IThULWmQt2RS9f8uhIVCj/9ZZKa5G20vUaJzCby0P9U=
+ </data>
+ </dict>
+ <key>Headers/JoyGemCallManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 4aqJC5wgayXjaD7XHafngtRL7PSKbqPdFujG27R7l4Q=
+ </data>
+ </dict>
+ <key>Headers/JoyGemChatManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 4ZkuysTzaFha4/myXFF57XtlqM0e4bMJIZlamlMNqm8=
+ </data>
+ </dict>
+ <key>Headers/JoyGemDeviceManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ zMSjXsvAeHKCWlyAIRTc/D/BYBU8crV81VAMtiRCNZA=
+ </data>
+ </dict>
+ <key>Headers/JoyGemEnum.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 6xL0kb6k/tdSxOKLIazlAA2o8gm1ZE3njRHg40EOYMw=
+ </data>
+ </dict>
+ <key>Headers/JoyGemModel.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ rFoRM/fmnvDGWCISlMyWSioYrwvoetaKOU8WrgOCBNw=
+ </data>
+ </dict>
+ <key>Headers/JoyGemParam.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ oXJjxfeaUmV4FnIP5DUB7MLED0QsP5hp0v0AqO8ttMs=
+ </data>
+ </dict>
+ <key>Headers/JoyGemRecordManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ C4rHebQlX6cKQWVmjh1cDetbe6cC+glcl2deSRF3r/o=
+ </data>
+ </dict>
+ <key>Headers/JoyGemSIDeviceManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ bkQU7XO+s/wbDHlWf9VM2kvGxB5myT2n0bEp+ac6tHo=
+ </data>
+ </dict>
+ <key>Headers/JoyGemSIManager.h</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ 5nObgPQx+QBZs8lbacCMnhBUJs629P/ZuVFJytUIV44=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/Project/arm64-apple-ios.swiftsourceinfo</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ ppJvM28BX4SQ+Bp40K+I9948VA34G8v2sowJEtO80vQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.abi.json</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ li11LC5FIVL81dorkSyLKnyNa2JtjEuBDo/IzoAeVCU=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.private.swiftinterface</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ c9qIPe1Wqd1NpKlpuawO+ORLNw5ws9/SFWK8GiWvotQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftdoc</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ lFffbgJPWht+xRXKPA4Nv2rrNTUSt2wtt9PtaTTwK6w=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftinterface</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ c9qIPe1Wqd1NpKlpuawO+ORLNw5ws9/SFWK8GiWvotQ=
+ </data>
+ </dict>
+ <key>Modules/JoyGemAI.swiftmodule/arm64-apple-ios.swiftmodule</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ oIPD6jOI3lmqwRw8fQIjIdbh/igLDvY7QXuX2vHol4M=
+ </data>
+ </dict>
+ <key>Modules/module.modulemap</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ EYrXhwPscfz6NC5xiiSHpFYdSR7Z5+JCyV2sAnxwmPc=
+ </data>
+ </dict>
+ <key>PrivacyInfo.xcprivacy</key>
+ <dict>
+ <key>hash2</key>
+ <data>
+ cuaVRkQIQRl8fLAPRH2XlUdsPxO0W90uL0WcSHvmSnY=
+ </data>
+ </dict>
+ </dict>
+ <key>rules</key>
+ <dict>
+ <key>^.*</key>
+ <true/>
+ <key>^.*\.lproj/</key>
+ <dict>
+ <key>optional</key>
+ <true/>
+ <key>weight</key>
+ <real>1000</real>
+ </dict>
+ <key>^.*\.lproj/locversion.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>1100</real>
+ </dict>
+ <key>^Base\.lproj/</key>
+ <dict>
+ <key>weight</key>
+ <real>1010</real>
+ </dict>
+ <key>^version.plist$</key>
+ <true/>
+ </dict>
+ <key>rules2</key>
+ <dict>
+ <key>.*\.dSYM($|/)</key>
+ <dict>
+ <key>weight</key>
+ <real>11</real>
+ </dict>
+ <key>^(.*/)?\.DS_Store$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>2000</real>
+ </dict>
+ <key>^.*</key>
+ <true/>
+ <key>^.*\.lproj/</key>
+ <dict>
+ <key>optional</key>
+ <true/>
+ <key>weight</key>
+ <real>1000</real>
+ </dict>
+ <key>^.*\.lproj/locversion.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>1100</real>
+ </dict>
+ <key>^Base\.lproj/</key>
+ <dict>
+ <key>weight</key>
+ <real>1010</real>
+ </dict>
+ <key>^Info\.plist$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^PkgInfo$</key>
+ <dict>
+ <key>omit</key>
+ <true/>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^embedded\.provisionprofile$</key>
+ <dict>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ <key>^version\.plist$</key>
+ <dict>
+ <key>weight</key>
+ <real>20</real>
+ </dict>
+ </dict>
+</dict>
+</plist>
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 77;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 059668912D6EC43400B8D41D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 0596687E2D6EC43400B8D41D /* Assets.xcassets */; };
+ 059668922D6EC43400B8D41D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 059668872D6EC43400B8D41D /* Main.storyboard */; };
+ 059668932D6EC43400B8D41D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 059668852D6EC43400B8D41D /* LaunchScreen.storyboard */; };
+ 059668952D6EC43400B8D41D /* OtherViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059668892D6EC43400B8D41D /* OtherViewController.swift */; };
+ 059668962D6EC43400B8D41D /* PcmSound.m in Sources */ = {isa = PBXBuildFile; fileRef = 0596688B2D6EC43400B8D41D /* PcmSound.m */; };
+ 059668972D6EC43400B8D41D /* SIViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596688F2D6EC43400B8D41D /* SIViewController.swift */; };
+ 059668982D6EC43400B8D41D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596688E2D6EC43400B8D41D /* SceneDelegate.swift */; };
+ 059668992D6EC43400B8D41D /* ChatViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596687F2D6EC43400B8D41D /* ChatViewController.swift */; };
+ 0596689A2D6EC43400B8D41D /* PeripheralViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596688C2D6EC43400B8D41D /* PeripheralViewController.swift */; };
+ 0596689B2D6EC43400B8D41D /* MainViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059668882D6EC43400B8D41D /* MainViewController.swift */; };
+ 0596689C2D6EC43400B8D41D /* RecordViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596688D2D6EC43400B8D41D /* RecordViewController.swift */; };
+ 0596689D2D6EC43400B8D41D /* DialogueViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059668802D6EC43400B8D41D /* DialogueViewController.swift */; };
+ 0596689E2D6EC43400B8D41D /* Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059668812D6EC43400B8D41D /* Extension.swift */; };
+ 0596689F2D6EC43400B8D41D /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0596687D2D6EC43400B8D41D /* AppDelegate.swift */; };
+ 059A002C2E6839A8002007C6 /* DeviceViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059A002A2E6839A8002007C6 /* DeviceViewController.swift */; };
+ 059A002D2E6839A8002007C6 /* CallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059A00292E6839A8002007C6 /* CallViewController.swift */; };
+ 059A002E2E6839A8002007C6 /* StereoCallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 059A002B2E6839A8002007C6 /* StereoCallViewController.swift */; };
+ 05A2920D2DAFCA8B00E1C39E /* ConfigViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05A2920C2DAFCA8B00E1C39E /* ConfigViewController.swift */; };
+ 05AD42B02E432BED00BAC3E8 /* JoyGemAI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 05A2A1A42D782B39000C198A /* JoyGemAI.framework */; };
+ 05AD42B12E432BED00BAC3E8 /* JoyGemAI.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 05A2A1A42D782B39000C198A /* JoyGemAI.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 05DB1F842DCDFFBC000761BF /* RecordCallViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 05DB1F832DCDFFBC000761BF /* RecordCallViewController.swift */; };
+ 69CE07F7C0E911EA772186EB /* Pods_JoyGemAIDemo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B2CFD5E22618961880D18F6A /* Pods_JoyGemAIDemo.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 05AD42B22E432BED00BAC3E8 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 05AD42B12E432BED00BAC3E8 /* JoyGemAI.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 0596687D2D6EC43400B8D41D /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
+ 0596687E2D6EC43400B8D41D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
+ 0596687F2D6EC43400B8D41D /* ChatViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatViewController.swift; sourceTree = "<group>"; };
+ 059668802D6EC43400B8D41D /* DialogueViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DialogueViewController.swift; sourceTree = "<group>"; };
+ 059668812D6EC43400B8D41D /* Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Extension.swift; sourceTree = "<group>"; };
+ 059668822D6EC43400B8D41D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
+ 059668832D6EC43400B8D41D /* JoyGemAIDemo-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JoyGemAIDemo-Bridging-Header.h"; sourceTree = "<group>"; };
+ 059668842D6EC43400B8D41D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
+ 059668862D6EC43400B8D41D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
+ 059668882D6EC43400B8D41D /* MainViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MainViewController.swift; sourceTree = "<group>"; };
+ 059668892D6EC43400B8D41D /* OtherViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OtherViewController.swift; sourceTree = "<group>"; };
+ 0596688A2D6EC43400B8D41D /* PcmSound.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PcmSound.h; sourceTree = "<group>"; };
+ 0596688B2D6EC43400B8D41D /* PcmSound.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PcmSound.m; sourceTree = "<group>"; };
+ 0596688C2D6EC43400B8D41D /* PeripheralViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PeripheralViewController.swift; sourceTree = "<group>"; };
+ 0596688D2D6EC43400B8D41D /* RecordViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordViewController.swift; sourceTree = "<group>"; };
+ 0596688E2D6EC43400B8D41D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
+ 0596688F2D6EC43400B8D41D /* SIViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SIViewController.swift; sourceTree = "<group>"; };
+ 059A00292E6839A8002007C6 /* CallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CallViewController.swift; sourceTree = "<group>"; };
+ 059A002A2E6839A8002007C6 /* DeviceViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceViewController.swift; sourceTree = "<group>"; };
+ 059A002B2E6839A8002007C6 /* StereoCallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StereoCallViewController.swift; sourceTree = "<group>"; };
+ 05A2920C2DAFCA8B00E1C39E /* ConfigViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigViewController.swift; sourceTree = "<group>"; };
+ 05A2A1A42D782B39000C198A /* JoyGemAI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JoyGemAI.framework; sourceTree = "<group>"; };
+ 05DB1F832DCDFFBC000761BF /* RecordCallViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RecordCallViewController.swift; sourceTree = "<group>"; };
+ 05F2E4562D599F3E0031BB28 /* JoyGemAIDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = JoyGemAIDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ AF63D4AE63F8369636743944 /* Pods-JoygemAIDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JoygemAIDemo.release.xcconfig"; path = "Target Support Files/Pods-JoygemAIDemo/Pods-JoygemAIDemo.release.xcconfig"; sourceTree = "<group>"; };
+ B2CFD5E22618961880D18F6A /* Pods_JoyGemAIDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JoyGemAIDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ BA3EBF65C77EB1A42DBDDA92 /* Pods-JoyGemAIDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JoyGemAIDemo.release.xcconfig"; path = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo.release.xcconfig"; sourceTree = "<group>"; };
+ DBDAAF1DCB03B45B52DECA3C /* Pods-JoyGemAIDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JoyGemAIDemo.debug.xcconfig"; path = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo.debug.xcconfig"; sourceTree = "<group>"; };
+ FD1732B60B5D0B4F6B8B0535 /* Pods-JoygemAIDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-JoygemAIDemo.debug.xcconfig"; path = "Target Support Files/Pods-JoygemAIDemo/Pods-JoygemAIDemo.debug.xcconfig"; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 05F2E4532D599F3E0031BB28 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 69CE07F7C0E911EA772186EB /* Pods_JoyGemAIDemo.framework in Frameworks */,
+ 05AD42B02E432BED00BAC3E8 /* JoyGemAI.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 059668902D6EC43400B8D41D /* JoyGemAIDemo */ = {
+ isa = PBXGroup;
+ children = (
+ 0596687D2D6EC43400B8D41D /* AppDelegate.swift */,
+ 059A00292E6839A8002007C6 /* CallViewController.swift */,
+ 0596687F2D6EC43400B8D41D /* ChatViewController.swift */,
+ 05A2920C2DAFCA8B00E1C39E /* ConfigViewController.swift */,
+ 059A002A2E6839A8002007C6 /* DeviceViewController.swift */,
+ 059668802D6EC43400B8D41D /* DialogueViewController.swift */,
+ 059668812D6EC43400B8D41D /* Extension.swift */,
+ 059668882D6EC43400B8D41D /* MainViewController.swift */,
+ 059668892D6EC43400B8D41D /* OtherViewController.swift */,
+ 0596688C2D6EC43400B8D41D /* PeripheralViewController.swift */,
+ 05DB1F832DCDFFBC000761BF /* RecordCallViewController.swift */,
+ 0596688D2D6EC43400B8D41D /* RecordViewController.swift */,
+ 0596688E2D6EC43400B8D41D /* SceneDelegate.swift */,
+ 0596688F2D6EC43400B8D41D /* SIViewController.swift */,
+ 059A002B2E6839A8002007C6 /* StereoCallViewController.swift */,
+ 0596687E2D6EC43400B8D41D /* Assets.xcassets */,
+ 059668852D6EC43400B8D41D /* LaunchScreen.storyboard */,
+ 059668872D6EC43400B8D41D /* Main.storyboard */,
+ 059668832D6EC43400B8D41D /* JoyGemAIDemo-Bridging-Header.h */,
+ 0596688A2D6EC43400B8D41D /* PcmSound.h */,
+ 0596688B2D6EC43400B8D41D /* PcmSound.m */,
+ 059668822D6EC43400B8D41D /* Info.plist */,
+ );
+ path = JoyGemAIDemo;
+ sourceTree = "<group>";
+ };
+ 05F2E44D2D599F3E0031BB28 = {
+ isa = PBXGroup;
+ children = (
+ 059668902D6EC43400B8D41D /* JoyGemAIDemo */,
+ 05F2E4572D599F3E0031BB28 /* Products */,
+ 63974ECFCD81206BA97C00D7 /* Pods */,
+ 8752043BF3087F4F7594B5D7 /* Frameworks */,
+ );
+ sourceTree = "<group>";
+ };
+ 05F2E4572D599F3E0031BB28 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 05F2E4562D599F3E0031BB28 /* JoyGemAIDemo.app */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 63974ECFCD81206BA97C00D7 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ FD1732B60B5D0B4F6B8B0535 /* Pods-JoygemAIDemo.debug.xcconfig */,
+ AF63D4AE63F8369636743944 /* Pods-JoygemAIDemo.release.xcconfig */,
+ DBDAAF1DCB03B45B52DECA3C /* Pods-JoyGemAIDemo.debug.xcconfig */,
+ BA3EBF65C77EB1A42DBDDA92 /* Pods-JoyGemAIDemo.release.xcconfig */,
+ );
+ path = Pods;
+ sourceTree = "<group>";
+ };
+ 8752043BF3087F4F7594B5D7 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 05A2A1A42D782B39000C198A /* JoyGemAI.framework */,
+ B2CFD5E22618961880D18F6A /* Pods_JoyGemAIDemo.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 05F2E4552D599F3E0031BB28 /* JoyGemAIDemo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 05F2E4692D599F400031BB28 /* Build configuration list for PBXNativeTarget "JoyGemAIDemo" */;
+ buildPhases = (
+ DA797B232201B60B79B0C84E /* [CP] Check Pods Manifest.lock */,
+ 05F2E4522D599F3E0031BB28 /* Sources */,
+ 05F2E4532D599F3E0031BB28 /* Frameworks */,
+ 05F2E4542D599F3E0031BB28 /* Resources */,
+ 70A64C05DE767D26E2D3F43D /* [CP] Embed Pods Frameworks */,
+ 05AD42B22E432BED00BAC3E8 /* Embed Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = JoyGemAIDemo;
+ productName = JoygemAIDemo;
+ productReference = 05F2E4562D599F3E0031BB28 /* JoyGemAIDemo.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 05F2E44E2D599F3E0031BB28 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ BuildIndependentTargetsInParallel = 1;
+ LastSwiftUpdateCheck = 1600;
+ LastUpgradeCheck = 1600;
+ TargetAttributes = {
+ 05F2E4552D599F3E0031BB28 = {
+ CreatedOnToolsVersion = 16.0;
+ LastSwiftMigration = 1600;
+ };
+ };
+ };
+ buildConfigurationList = 05F2E4512D599F3E0031BB28 /* Build configuration list for PBXProject "JoyGemAIDemo" */;
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 05F2E44D2D599F3E0031BB28;
+ minimizedProjectReferenceProxies = 1;
+ preferredProjectObjectVersion = 77;
+ productRefGroup = 05F2E4572D599F3E0031BB28 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 05F2E4552D599F3E0031BB28 /* JoyGemAIDemo */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 05F2E4542D599F3E0031BB28 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 059668912D6EC43400B8D41D /* Assets.xcassets in Resources */,
+ 059668922D6EC43400B8D41D /* Main.storyboard in Resources */,
+ 059668932D6EC43400B8D41D /* LaunchScreen.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 70A64C05DE767D26E2D3F43D /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-frameworks-${CONFIGURATION}-input-files.xcfilelist",
+ );
+ inputPaths = (
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputFileListPaths = (
+ "${PODS_ROOT}/Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-frameworks-${CONFIGURATION}-output-files.xcfilelist",
+ );
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+ DA797B232201B60B79B0C84E /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputFileListPaths = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputFileListPaths = (
+ );
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-JoyGemAIDemo-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 05F2E4522D599F3E0031BB28 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 059668952D6EC43400B8D41D /* OtherViewController.swift in Sources */,
+ 059668962D6EC43400B8D41D /* PcmSound.m in Sources */,
+ 05A2920D2DAFCA8B00E1C39E /* ConfigViewController.swift in Sources */,
+ 059668972D6EC43400B8D41D /* SIViewController.swift in Sources */,
+ 059668982D6EC43400B8D41D /* SceneDelegate.swift in Sources */,
+ 05DB1F842DCDFFBC000761BF /* RecordCallViewController.swift in Sources */,
+ 059668992D6EC43400B8D41D /* ChatViewController.swift in Sources */,
+ 0596689A2D6EC43400B8D41D /* PeripheralViewController.swift in Sources */,
+ 0596689B2D6EC43400B8D41D /* MainViewController.swift in Sources */,
+ 0596689C2D6EC43400B8D41D /* RecordViewController.swift in Sources */,
+ 0596689D2D6EC43400B8D41D /* DialogueViewController.swift in Sources */,
+ 0596689E2D6EC43400B8D41D /* Extension.swift in Sources */,
+ 059A002C2E6839A8002007C6 /* DeviceViewController.swift in Sources */,
+ 059A002D2E6839A8002007C6 /* CallViewController.swift in Sources */,
+ 059A002E2E6839A8002007C6 /* StereoCallViewController.swift in Sources */,
+ 0596689F2D6EC43400B8D41D /* AppDelegate.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 059668852D6EC43400B8D41D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 059668842D6EC43400B8D41D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "<group>";
+ };
+ 059668872D6EC43400B8D41D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 059668862D6EC43400B8D41D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "<group>";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 05F2E46A2D599F400031BB28 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = DBDAAF1DCB03B45B52DECA3C /* Pods-JoyGemAIDemo.debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = M33X987285;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)",
+ );
+ GENERATE_INFOPLIST_FILE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD/SVProgressHUD.framework/Headers\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket/SocketRocket.framework/Headers\"",
+ "\"$(SRCROOT)/JoyGemAI.framework/Headers\"",
+ );
+ INFOPLIST_FILE = JoyGemAIDemo/Info.plist;
+ INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "蓝牙";
+ INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "蓝牙";
+ INFOPLIST_KEY_NSMicrophoneUsageDescription = "麦克风";
+ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
+ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
+ INFOPLIST_KEY_UIMainStoryboardFile = Main;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0.1;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "-all_load",
+ "$(inherited)",
+ "-l\"icucore\"",
+ "-l\"swiftCoreGraphics\"",
+ "-framework",
+ "\"CFNetwork\"",
+ "-framework",
+ "\"QuartzCore\"",
+ "-framework",
+ "\"SVProgressHUD\"",
+ "-framework",
+ "\"Security\"",
+ "-framework",
+ "\"SnapKit\"",
+ "-framework",
+ "\"SocketRocket\"",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.joygem.aidemo;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+ SUPPORTS_MACCATALYST = NO;
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_OBJC_BRIDGING_HEADER = "JoyGemAIDemo/JoyGemAIDemo-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = 1;
+ };
+ name = Debug;
+ };
+ 05F2E46B2D599F400031BB28 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = BA3EBF65C77EB1A42DBDDA92 /* Pods-JoyGemAIDemo.release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
+ CLANG_ENABLE_MODULES = YES;
+ CODE_SIGN_STYLE = Automatic;
+ CURRENT_PROJECT_VERSION = 1;
+ DEVELOPMENT_TEAM = M33X987285;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)",
+ );
+ GENERATE_INFOPLIST_FILE = YES;
+ HEADER_SEARCH_PATHS = (
+ "$(inherited)",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD/SVProgressHUD.framework/Headers\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers\"",
+ "\"${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket/SocketRocket.framework/Headers\"",
+ "\"$(SRCROOT)/JoyGemAI.framework/Headers\"",
+ );
+ INFOPLIST_FILE = JoyGemAIDemo/Info.plist;
+ INFOPLIST_KEY_NSBluetoothAlwaysUsageDescription = "蓝牙";
+ INFOPLIST_KEY_NSBluetoothPeripheralUsageDescription = "蓝牙";
+ INFOPLIST_KEY_NSMicrophoneUsageDescription = "麦克风";
+ INFOPLIST_KEY_UIApplicationSupportsIndirectInputEvents = YES;
+ INFOPLIST_KEY_UILaunchStoryboardName = LaunchScreen;
+ INFOPLIST_KEY_UIMainStoryboardFile = Main;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations = UIInterfaceOrientationPortrait;
+ INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight UIInterfaceOrientationPortrait";
+ IPHONEOS_DEPLOYMENT_TARGET = 15.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0.1;
+ OTHER_LDFLAGS = (
+ "-ObjC",
+ "-all_load",
+ "$(inherited)",
+ "-l\"icucore\"",
+ "-l\"swiftCoreGraphics\"",
+ "-framework",
+ "\"CFNetwork\"",
+ "-framework",
+ "\"QuartzCore\"",
+ "-framework",
+ "\"SVProgressHUD\"",
+ "-framework",
+ "\"Security\"",
+ "-framework",
+ "\"SnapKit\"",
+ "-framework",
+ "\"SocketRocket\"",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.joygem.aidemo;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SUPPORTED_PLATFORMS = "iphoneos iphonesimulator";
+ SUPPORTS_MACCATALYST = NO;
+ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
+ SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_OBJC_BRIDGING_HEADER = "JoyGemAIDemo/JoyGemAIDemo-Bridging-Header.h";
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = 1;
+ };
+ name = Release;
+ };
+ 05F2E46C2D599F400031BB28 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu17;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
+ LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "DEBUG $(inherited)";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ };
+ name = Debug;
+ };
+ 05F2E46D2D599F400031BB28 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu17;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 18.0;
+ LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ SDKROOT = iphoneos;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 05F2E4512D599F3E0031BB28 /* Build configuration list for PBXProject "JoyGemAIDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 05F2E46C2D599F400031BB28 /* Debug */,
+ 05F2E46D2D599F400031BB28 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 05F2E4692D599F400031BB28 /* Build configuration list for PBXNativeTarget "JoyGemAIDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 05F2E46A2D599F400031BB28 /* Debug */,
+ 05F2E46B2D599F400031BB28 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 05F2E44E2D599F3E0031BB28 /* Project object */;
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "self:">
+ </FileRef>
+</Workspace>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Scheme
+ LastUpgradeVersion = "1600"
+ version = "1.7">
+ <BuildAction
+ parallelizeBuildables = "YES"
+ buildImplicitDependencies = "YES"
+ buildArchitectures = "Automatic">
+ <BuildActionEntries>
+ <BuildActionEntry
+ buildForTesting = "YES"
+ buildForRunning = "YES"
+ buildForProfiling = "YES"
+ buildForArchiving = "YES"
+ buildForAnalyzing = "YES">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "05F2E4552D599F3E0031BB28"
+ BuildableName = "JoyGemAIDemo.app"
+ BlueprintName = "JoyGemAIDemo"
+ ReferencedContainer = "container:JoyGemAIDemo.xcodeproj">
+ </BuildableReference>
+ </BuildActionEntry>
+ </BuildActionEntries>
+ </BuildAction>
+ <TestAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ shouldAutocreateTestPlan = "YES">
+ </TestAction>
+ <LaunchAction
+ buildConfiguration = "Debug"
+ selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
+ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
+ launchStyle = "0"
+ useCustomWorkingDirectory = "NO"
+ ignoresPersistentStateOnLaunch = "NO"
+ debugDocumentVersioning = "YES"
+ debugServiceExtension = "internal"
+ allowLocationSimulation = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "05F2E4552D599F3E0031BB28"
+ BuildableName = "JoyGemAIDemo.app"
+ BlueprintName = "JoyGemAIDemo"
+ ReferencedContainer = "container:JoyGemAIDemo.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </LaunchAction>
+ <ProfileAction
+ buildConfiguration = "Release"
+ shouldUseLaunchSchemeArgsEnv = "YES"
+ savedToolIdentifier = ""
+ useCustomWorkingDirectory = "NO"
+ debugDocumentVersioning = "YES">
+ <BuildableProductRunnable
+ runnableDebuggingMode = "0">
+ <BuildableReference
+ BuildableIdentifier = "primary"
+ BlueprintIdentifier = "05F2E4552D599F3E0031BB28"
+ BuildableName = "JoyGemAIDemo.app"
+ BlueprintName = "JoyGemAIDemo"
+ ReferencedContainer = "container:JoyGemAIDemo.xcodeproj">
+ </BuildableReference>
+ </BuildableProductRunnable>
+ </ProfileAction>
+ <AnalyzeAction
+ buildConfiguration = "Debug">
+ </AnalyzeAction>
+ <ArchiveAction
+ buildConfiguration = "Release"
+ revealArchiveInOrganizer = "YES">
+ </ArchiveAction>
+</Scheme>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+ version = "1.0">
+ <FileRef
+ location = "group:JoyGemAIDemo.xcodeproj">
+ </FileRef>
+ <FileRef
+ location = "group:Pods/Pods.xcodeproj">
+ </FileRef>
+</Workspace>
--- /dev/null
+//
+// AppDelegate.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+import UIKit
+import AVFoundation
+
+@main
+class AppDelegate: UIResponder, UIApplicationDelegate {
+
+
+ func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
+ // Override point for customization after application launch.
+ // 添加观察者
+// NotificationCenter.default.addObserver(
+// self,
+// selector: #selector(handleRouteChange),
+// name: AVAudioSession.routeChangeNotification,
+// object: nil
+// )
+//
+// let dir = NSTemporaryDirectory()
+// debugPrint(dir)
+
+ return true
+ }
+
+ // MARK: UISceneSession Lifecycle
+
+ func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration {
+ // Called when a new scene session is being created.
+ // Use this method to select a configuration to create the new scene with.
+ return UISceneConfiguration(name: "Default Configuration", sessionRole: connectingSceneSession.role)
+ }
+
+ func application(_ application: UIApplication, didDiscardSceneSessions sceneSessions: Set<UISceneSession>) {
+ // Called when the user discards a scene session.
+ // If any sessions were discarded while the application was not running, this will be called shortly after application:didFinishLaunchingWithOptions.
+ // Use this method to release any resources that were specific to the discarded scenes, as they will not return.
+ }
+
+ @objc func handleRouteChange(notification: Notification) {
+ guard let userInfo = notification.userInfo,
+ let reasonValue = userInfo[AVAudioSessionRouteChangeReasonKey] as? UInt,
+ let reason = AVAudioSession.RouteChangeReason(rawValue: reasonValue) else {
+ return
+ }
+
+ switch reason {
+ case .unknown:
+ print("Audio category unknown")
+ case .newDeviceAvailable:
+ // 新设备可用(如耳机插入)
+ print("Audio category New device available")
+ case .oldDeviceUnavailable:
+ // 旧设备不可用(如耳机拔出)
+ print("Audio category Old device unavailable")
+ case .categoryChange:
+ // 音频类别发生变化
+ print("Audio category changed")
+ case .noSuitableRouteForCategory:
+ print("Audio category noSuitableRouteForCategory")
+ case .override:
+ print("Audio category override")
+ case .wakeFromSleep:
+ print("Audio category wakeFromSleep")
+ case .routeConfigurationChange:
+ print("Audio category routeConfigurationChange")
+ @unknown default:
+ print("Audio category default")
+ }
+ }
+
+}
+
--- /dev/null
+{
+ "colors" : [
+ {
+ "idiom" : "universal"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "images" : [
+ {
+ "filename" : "20250226-104946.jpeg",
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "dark"
+ }
+ ],
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ },
+ {
+ "appearances" : [
+ {
+ "appearance" : "luminosity",
+ "value" : "tinted"
+ }
+ ],
+ "idiom" : "universal",
+ "platform" : "ios",
+ "size" : "1024x1024"
+ }
+ ],
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+{
+ "info" : {
+ "author" : "xcode",
+ "version" : 1
+ }
+}
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="01J-lp-oVM">
+ <dependencies>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+ </dependencies>
+ <scenes>
+ <!--View Controller-->
+ <scene sceneID="EHf-IW-A2E">
+ <objects>
+ <viewController id="01J-lp-oVM" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
+ <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
+ </view>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="53" y="375"/>
+ </scene>
+ </scenes>
+</document>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="23094" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="xWg-az-U1T">
+ <device id="retina6_12" orientation="portrait" appearance="light"/>
+ <dependencies>
+ <deployment identifier="iOS"/>
+ <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="23084"/>
+ <capability name="Safe area layout guides" minToolsVersion="9.0"/>
+ <capability name="System colors in document resources" minToolsVersion="11.0"/>
+ <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
+ </dependencies>
+ <scenes>
+ <!--Navigation Controller-->
+ <scene sceneID="S4u-9K-FhC">
+ <objects>
+ <navigationController id="xWg-az-U1T" sceneMemberID="viewController">
+ <navigationBar key="navigationBar" contentMode="scaleToFill" id="ygV-aH-lnK">
+ <rect key="frame" x="0.0" y="59" width="393" height="44"/>
+ <autoresizingMask key="autoresizingMask"/>
+ </navigationBar>
+ <connections>
+ <segue destination="BYZ-38-t0r" kind="relationship" relationship="rootViewController" id="Dl6-7B-XNs"/>
+ </connections>
+ </navigationController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="SGv-te-JbP" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-1459" y="-101"/>
+ </scene>
+ <!--Main View Controller-->
+ <scene sceneID="tne-QT-ifu">
+ <objects>
+ <viewController id="BYZ-38-t0r" customClass="MainViewController" customModule="JoygemAIDemo" customModuleProvider="target" sceneMemberID="viewController">
+ <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
+ <rect key="frame" x="0.0" y="0.0" width="393" height="852"/>
+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
+ <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
+ <color key="backgroundColor" systemColor="systemBackgroundColor"/>
+ </view>
+ <navigationItem key="navigationItem" id="rRi-sQ-2mm"/>
+ </viewController>
+ <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
+ </objects>
+ <point key="canvasLocation" x="-474.04580152671753" y="-101.40845070422536"/>
+ </scene>
+ </scenes>
+ <resources>
+ <systemColor name="systemBackgroundColor">
+ <color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
+ </systemColor>
+ </resources>
+</document>
--- /dev/null
+//
+// RecordCallViewController.swift
+// JoyGemAIPod
+//
+// Created by jjjs on 2025/5/6.
+//
+
+import UIKit
+import SnapKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+class CallViewController: UIViewController {
+
+ var textView : UITextView!
+
+ var startButton : UIButton!
+
+ var stopButton : UIButton!
+
+ var messageList : [(String,UInt)] = []
+
+ var recordFilePath : String?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "通话录音"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "播放录音", style: .done, target: self, action: #selector(playRecord))
+ ]
+
+ textView = UITextView()
+ view.addSubview(textView)
+ textView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-100)
+ }
+ textView.backgroundColor = UIColor.gray
+ startButton = UIButton(type: .custom)
+ view.addSubview(startButton)
+ startButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ startButton.setTitle("开始", for: .normal)
+ startButton.setTitleColor(UIColor.darkText, for: .normal)
+ startButton.addTarget(self, action: #selector(startRecord), for: .touchUpInside)
+
+ stopButton = UIButton(type: .custom)
+ view.addSubview(stopButton)
+ stopButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ stopButton.setTitle("结束", for: .normal)
+ stopButton.setTitleColor(UIColor.darkText, for: .normal)
+ stopButton.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
+
+ // Do any additional setup after loading the view.
+ JoyGemCallManager.shared().delegate = self
+ }
+
+ @objc func startRecord() {
+ messageList.removeAll()
+ textView.text = nil
+ JoyGemCallManager.shared().start()
+ }
+
+ @objc func endRecord() {
+ JoyGemCallManager.shared().stop()
+ }
+
+ var audioPlayer: AVAudioPlayer?
+
+ ///播放最后一次录音文件
+ @objc func playRecord() {
+ guard let file = recordFilePath else {return;}
+
+ do {
+ // 创建 AVAudioPlayer 实例
+ audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: file))
+ audioPlayer?.prepareToPlay() // 准备播放
+ audioPlayer?.play() // 播放音频
+ } catch {
+ debugPrint("播放音频时发生错误: \(error.localizedDescription)")
+ }
+ }
+
+}
+
+extension CallViewController : JoyGemCallManagerDelegate {
+
+ func callManagerStopped(_ manager: JoyGemCallManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ SVProgressHUD.showInfo(withStatus: "用户主动结束")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "自动结束")
+ ///判断当前蓝牙是否连接从而确定是否因为蓝牙断开造成的录音断开
+ }
+ }
+
+ func callManagerNotonCall(_ manager: JoyGemCallManager) {
+ SVProgressHUD.showInfo(withStatus: "未处于通话状态")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func callManager(_ manager: JoyGemCallManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, onError code: JoyGemErrorCode) {
+
+ }
+
+ func callManager(_ manager: JoyGemCallManager, didUpdateAsr model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = messageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ messageList.append((model.text,model.index))
+ } else {
+ messageList[msg!] = (model.text,model.index)
+ }
+
+ textView.text = messageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+
+}
+
+
--- /dev/null
+//
+// ChatViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+import UIKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+class ChatViewController: UIViewController {
+
+ var isTtsPlaying = false
+ internal var requestTextView : UITextView!
+ internal var responseTextView : UITextView!
+ internal var stateLabel : UILabel = UILabel()
+
+ internal var singleButton : UIButton = UIButton(type: .custom)
+
+ internal var chatButton : UIButton = UIButton(type: .custom)
+
+ var speakers : [JoyGemSpeaker] = []
+ var selectedSpeaker: JoyGemSpeaker?
+
+ override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+ super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+
+ }
+
+ required init?(coder: NSCoder) {
+ fatalError("init(coder:) has not been implemented")
+ }
+
+ deinit {
+ if (!JoyGemChatManager.shared().supportEvent) {
+ JoyGemChatManager.shared().removeObserver(self, forKeyPath: "isActive")
+ }
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "AI对话"
+
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "角色", style: .done, target: self, action: #selector(speakerAction)),
+ ]
+
+ requestTextView = UITextView()
+ view.addSubview(requestTextView)
+ requestTextView.backgroundColor = UIColor.gray
+ requestTextView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.snp.centerY).offset(-50)
+ }
+ responseTextView = UITextView()
+ view.addSubview(responseTextView)
+ responseTextView.backgroundColor = UIColor.yellow
+ responseTextView.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(requestTextView.snp.bottom)
+ make.height.equalTo(requestTextView.snp.height)
+ }
+
+ view.addSubview(singleButton)
+ singleButton.snp.makeConstraints { make in
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-60)
+ make.height.equalTo(40)
+ make.left.equalToSuperview().offset(20)
+ make.right.equalTo(view.snp.centerX).offset(-20)
+ }
+ singleButton.setTitle("长按对话", for: .normal)
+ singleButton.setTitle("松开结束", for: .highlighted)
+ singleButton.setTitleColor(UIColor.black, for: .normal)
+ singleButton.backgroundColor = UIColor.gray
+ singleButton.addTarget(self, action: #selector(singleChatStart), for: .touchDown)
+ singleButton.addTarget(self, action: #selector(singleChatEnd), for: .touchUpInside)
+
+ view.addSubview(chatButton)
+ chatButton.snp.makeConstraints { make in
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-60)
+ make.height.equalTo(40)
+ make.right.equalToSuperview().offset(-20)
+ make.left.equalTo(view.snp.centerX).offset(20)
+ }
+ chatButton.setTitle("开启对话", for: .normal)
+ chatButton.setTitle("结束对话", for: .selected)
+ chatButton.backgroundColor = UIColor.gray
+ chatButton.setTitleColor(UIColor.black, for: .normal)
+ chatButton.addTarget(self, action: #selector(chatControl(sender:)), for: .touchUpInside)
+
+ view.addSubview(stateLabel)
+ stateLabel.snp.makeConstraints { make in
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-10)
+ make.height.equalTo(40)
+ make.width.equalTo(200)
+ make.centerX.equalToSuperview()
+ }
+ stateLabel.textColor = UIColor.black
+ stateLabel.text = "操作耳机"
+
+ JoyGemChatManager.shared().delegate = self
+ PcmSound.sharedInstance().delegate = self
+
+ if (!JoyGemChatManager.shared().supportEvent) {
+ JoyGemChatManager.shared().addObserver(self, forKeyPath: "isActive",options: [.new, .old], context: nil);
+ }
+ }
+
+ override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) {
+ if (keyPath == "isActive") {
+ var isOpen = change?[NSKeyValueChangeKey.newKey] as? Bool
+ if (isOpen == true) {
+ SVProgressHUD.showInfo(withStatus: "AI对话开启")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "AI对话结束")
+ PcmSound.sharedInstance().cleanup()
+ }
+ }
+ }
+
+
+ override func viewWillDisappear(_ animated: Bool) {
+ super.viewWillDisappear(animated)
+
+ ///结束对话,但并不会终止正在播放的录音
+ JoyGemChatManager.shared().stopChat()
+ }
+
+ @objc func singleChatStart() {
+ JoyGemChatManager.shared().startSingleChat()
+ }
+
+ @objc func singleChatEnd() {
+ JoyGemChatManager.shared().stopSingleChat()
+ }
+
+ @objc func chatControl(sender : UIButton) {
+ if (sender.isSelected) {
+ JoyGemChatManager.shared().stopChat()
+ sender.isSelected = false
+ } else {
+ JoyGemChatManager.shared().startChat()
+ sender.isSelected = true
+ }
+ }
+
+ @objc func speakerAction() {
+ ///获取用户信息
+ JoyGemChatManager.shared().getSpeakerList {[weak self] speakers in
+ self?.speakers = speakers;
+ self?.showPickerView()
+ }
+ }
+
+ func showPickerView() {
+ // 创建 UIAlertController
+ let alertController = UIAlertController(title: "选择一个选项", message: nil, preferredStyle: .actionSheet)
+
+ for speaker in speakers {
+ // 添加确认按钮
+ let confirmAction = UIAlertAction(title: speaker.name, style: .default) { _ in
+ // 处理确认选择
+ JoyGemChatManager.shared().setSpeaker(speaker)
+ }
+ alertController.addAction(confirmAction)
+ }
+
+ // 添加取消按钮
+ let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
+ alertController.addAction(cancelAction)
+
+ // 显示提示框
+ present(alertController, animated: true, completion: nil)
+ }
+}
+
+extension ChatViewController : UIPickerViewDelegate,UIPickerViewDataSource {
+
+ func numberOfComponents(in pickerView: UIPickerView) -> Int {
+ 1
+ }
+
+ func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
+ return speakers.count
+ }
+
+ func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
+ return speakers[row].name
+ }
+
+ func pickerView(_ pickerView: UIPickerView, didSelectRow row: Int, inComponent component: Int) {
+ selectedSpeaker = speakers[row]
+ }
+}
+
+extension ChatViewController : JoyGemChatManagerDelegate {
+
+
+ func chatManager(_ manager: JoyGemChatManager, stateChange code: JoyGemStateCode) {
+ switch code {
+ case .startRecord:
+ if (isTtsPlaying) {
+ isTtsPlaying = false
+ PcmSound.sharedInstance().cleanup()
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+ stateLabel.text = "正在录音"
+ break
+ case .stopRecord:
+ stateLabel.text = "操作耳机"
+ break
+ default:
+ break
+ }
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, onError code: JoyGemErrorCode) {
+
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, audioData data: Data?, finish isFinish: Bool) {
+ if (!isTtsPlaying) {
+ isTtsPlaying = true
+ JoyGemChatManager.shared().playAudioStart()
+ }
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, requestText text: String?, index: UInt) {
+
+ requestTextView.text = text;
+
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, responseText text: String?, index: UInt, finish isFinish: Bool) {
+ if (isFinish) {
+ responseTextView.text = text;
+ }
+ }
+
+ func chatManager(_ manager: JoyGemChatManager, eventUpdate event: JoyGemChatEvent) {
+ switch event {
+ case .begin:
+ SVProgressHUD.showInfo(withStatus: "对话开始")
+ case .end:
+ SVProgressHUD.showInfo(withStatus: "对话结束")
+ default:
+ break
+ }
+ }
+}
+
+extension ChatViewController : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ print("[frame:\(frames)]");
+ if (frames == 0) {
+ JoyGemChatManager.shared().playAudioEnd()
+ }
+ }
+}
--- /dev/null
+//
+// ConfigViewController.swift
+// JoyGemAIPod
+//
+// Created by jjjs on 2025/4/12.
+//
+
+import Foundation
+import JoyGemAI
+import SVProgressHUD
+
+class ConfigViewController: UIViewController {
+
+ internal var batteryButton : UIButton = UIButton(type: .custom)
+
+ internal var addressButton : UIButton = UIButton(type: .custom)
+
+ internal var statusButton : UIButton = UIButton(type: .custom)
+
+ internal var versionButton : UIButton = UIButton(type: .custom)
+
+ internal var clearButton : UIButton = UIButton(type: .custom)
+
+ internal var vadButton : UIButton = UIButton(type: .custom)
+
+ deinit {
+
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = .white
+ title = "配置"
+
+ view.addSubview(batteryButton)
+ batteryButton.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ batteryButton.setTitle("获取电量", for: .normal)
+ batteryButton.setTitleColor(UIColor.black, for: .normal)
+ batteryButton.backgroundColor = UIColor.gray
+ batteryButton.addTarget(self, action: #selector(batteryAction), for: .touchUpInside)
+
+ view.addSubview(addressButton)
+ addressButton.snp.makeConstraints { make in
+ make.top.equalTo(batteryButton.snp.bottom).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ addressButton.setTitle("获取地址", for: .normal)
+ addressButton.backgroundColor = UIColor.gray
+ addressButton.setTitleColor(UIColor.black, for: .normal)
+ addressButton.addTarget(self, action: #selector(addressAction), for: .touchUpInside)
+
+ view.addSubview(statusButton)
+ statusButton.snp.makeConstraints { make in
+ make.top.equalTo(addressButton.snp.bottom).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ statusButton.setTitle("获取经典蓝牙连接状态", for: .normal)
+ statusButton.backgroundColor = UIColor.gray
+ statusButton.setTitleColor(UIColor.black, for: .normal)
+ statusButton.addTarget(self, action: #selector(statusAction), for: .touchUpInside)
+
+ view.addSubview(versionButton)
+ versionButton.snp.makeConstraints { make in
+ make.top.equalTo(statusButton.snp.bottom).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ versionButton.setTitle("获取软件版本号", for: .normal)
+ versionButton.backgroundColor = UIColor.gray
+ versionButton.setTitleColor(UIColor.black, for: .normal)
+ versionButton.addTarget(self, action: #selector(versionAction), for: .touchUpInside)
+
+ view.addSubview(clearButton)
+ clearButton.snp.makeConstraints { make in
+ make.top.equalTo(versionButton.snp.bottom).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ clearButton.setTitle("清理缓存文件夹", for: .normal)
+ clearButton.backgroundColor = UIColor.gray
+ clearButton.setTitleColor(UIColor.black, for: .normal)
+ clearButton.addTarget(self, action: #selector(clearAction), for: .touchUpInside)
+
+ view.addSubview(vadButton)
+ vadButton.snp.makeConstraints { make in
+ make.top.equalTo(clearButton.snp.bottom).offset(60)
+ make.height.equalTo(40)
+ make.centerX.equalToSuperview()
+ make.width.equalTo(200)
+ }
+ vadButton.setTitle("设置VAD打断", for: .normal)
+ vadButton.backgroundColor = UIColor.gray
+ vadButton.setTitleColor(UIColor.black, for: .normal)
+ vadButton.addTarget(self, action: #selector(vadSetAcition), for: .touchUpInside)
+
+ JoyGemAIManager.shared().device.setBatteryListener { left, right in
+ debugPrint("left:\(left)");
+ debugPrint("right:\(right)");
+ }
+
+ JoyGemAIManager.shared().device.setStatusListener { bt, tws in
+ debugPrint("btConnected:\(bt)");
+ debugPrint("twsConnected:\(tws)");
+ }
+
+
+
+
+
+ }
+
+ @objc func addressAction() {
+ JoyGemAIManager.shared().device.macAddress { edr, ble in
+ debugPrint("edr:\(edr)");
+ debugPrint("ble:\(ble)");
+ } error: { error in
+ debugPrint("\(error!.localizedDescription)");
+ }
+
+ }
+
+ @objc func batteryAction() {
+ JoyGemAIManager.shared().device.updateBattery()
+ }
+
+ @objc func statusAction() {
+ JoyGemAIManager.shared().device.updateStatus()
+ }
+
+ @objc func versionAction() {
+ JoyGemAIManager.shared().device.software { version in
+ debugPrint("version:\(version)");
+ } error: { error in
+ debugPrint("\(error!.localizedDescription)");
+ }
+ }
+
+ @objc func clearAction() {
+ JoyGemAIManager.shared().clearCacheDirectory()
+ }
+
+ @objc func vadSetAcition() {
+ JoyGemAIManager.shared().device.setVADInterruptedStatus(true) { error in
+ if (error == nil) {
+ debugPrint("设置成功");
+ } else {
+ SVProgressHUD.showError(withStatus: error?.localizedDescription)
+ }
+ }
+ }
+
+ @objc func vadGetAcition() {
+
+ }
+}
+
--- /dev/null
+//
+// DeviceViewController.swift
+// JoyGemAIPod
+//
+// Created by jjjs on 2025/9/2.
+//
+
+import UIKit
+import JoyGemAI
+
+class DeviceViewController: UIViewController {
+
+ let list:[(name:String,action:String)] = [
+ ("获取EQ","eqGetAction"),
+ ("设置EQ","eqSetAction"),
+ ("获取自定义EQ","customEqGetAction"),
+ ("设置自定义EQ","customEqSetAction"),
+ ("重置自定义EQ","customEqResetAction"),
+ ("查找耳机","findHeadphoneAction"),
+ ]
+
+ var tableView: UITableView!
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ title = "设备操作"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+
+ tableView = UITableView(frame: CGRectZero, style: UITableView.Style.grouped)
+ tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "cell")
+ view.addSubview(tableView)
+ tableView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ tableView.dataSource = self
+ tableView.delegate = self
+ }
+
+
+ /*
+ // MARK: - Navigation
+
+ // In a storyboard-based application, you will often want to do a little preparation before navigation
+ override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
+ // Get the new view controller using segue.destination.
+ // Pass the selected object to the new view controller.
+ }
+ */
+
+}
+
+extension DeviceViewController: UITableViewDataSource,UITableViewDelegate {
+
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ return 60
+ }
+
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return list.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
+ cell.textLabel?.text = list[indexPath.row].name
+ return cell
+ }
+
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ let data = list[indexPath.row]
+ let action = Selector(data.action)
+ self.perform(action)
+ }
+
+}
+
+extension DeviceViewController {
+
+ @objc func eqGetAction() {
+ JoyGemAIManager.shared().device.getEQMode { mode in
+ debugPrint("getEQMode:\(mode)");
+ } error: { err in
+ debugPrint("getEQMode:\(err)");
+ }
+ }
+
+ @objc func eqSetAction() {
+ let alertController = UIAlertController(
+ title: "选择操作",
+ message: "请从以下选项中选择一个",
+ preferredStyle: .actionSheet
+ )
+
+ let titles : [String] = ["普通","摇滚","流行","经典","爵士","自定义"]
+ let options : [JoyGemEQMode] = [.normal,.rock,.pop,.classic,.jazz,.custom]
+ for (idx,title) in titles.enumerated() {
+ let action = UIAlertAction(
+ title: title,
+ style: .default
+ ) { _ in
+ // 处理选择
+ JoyGemAIManager.shared().device.setEQMode(options[idx]) { err in
+ debugPrint("setEQMode:\(err)");
+ }
+ }
+ alertController.addAction(action)
+ }
+
+ // 添加取消按钮
+ let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
+ alertController.addAction(cancelAction)
+
+ present(alertController, animated: true, completion: nil)
+
+ }
+
+ @objc func customEqGetAction() {
+ JoyGemAIManager.shared().device.getCustomEQ { eq in
+ debugPrint("getCustomEQ:\(eq)");
+ } error: { err in
+ debugPrint("getCustomEQ:\(err)");
+ }
+ }
+
+ @objc func customEqSetAction() {
+ let pickerVC = DoublePickerViewController()
+ pickerVC.modalPresentationStyle = .pageSheet // 或 .formSheet
+
+ pickerVC.onValuesSelected = { leftValue, rightValue in
+ JoyGemAIManager.shared().device.setCustomEQ(UInt(leftValue), withGain: rightValue) { err in
+ debugPrint("setCustomEQ:\(err)");
+ }
+ }
+
+ pickerVC.onCancel = {
+ print("用户取消了选择")
+ }
+
+ present(pickerVC, animated: true)
+
+
+ }
+
+ @objc func customEqResetAction() {
+ JoyGemAIManager.shared().device.resetCustomEQ { err in
+ debugPrint("resetCustomEQ:\(err)");
+ }
+ }
+
+ @objc func findHeadphoneAction() {
+ let alertController = UIAlertController(
+ title: "选择操作",
+ message: "请从以下选项中选择一个",
+ preferredStyle: .actionSheet
+ )
+
+ let titles : [String] = ["关闭","左耳","右耳","双耳"]
+ let options : [JoyGemFindHeadphoneMode] = [.cancel,.left,.right,.all]
+
+ for (idx,title) in titles.enumerated() {
+ let action = UIAlertAction(
+ title: title,
+ style: .default
+ ) { _ in
+ JoyGemAIManager.shared().device.findHeadphone(options[idx]) { err in
+ debugPrint("findHeadphone:\(err)");
+ }
+ }
+ alertController.addAction(action)
+ }
+
+ // 添加取消按钮
+ let cancelAction = UIAlertAction(title: "取消", style: .cancel, handler: nil)
+ alertController.addAction(cancelAction)
+
+ present(alertController, animated: true, completion: nil)
+
+ }
+
+}
+
+
+class DoublePickerViewController: UIViewController {
+
+ var onValuesSelected: (Int, Int) -> Void = { _,_ in }
+ var onCancel: () -> Void = {}
+
+ // 你的两列数据
+ let leftOptions = Array(stride(from: 0, through: 9, by: 1))
+ let rightOptions = Array(stride(from: -12, through: 12, by: 1))
+
+ private let pickerView: UIPickerView = {
+ let picker = UIPickerView()
+ picker.translatesAutoresizingMaskIntoConstraints = false
+ return picker
+ }()
+
+ private let toolbar: UIToolbar = {
+ let toolBar = UIToolbar()
+ toolBar.translatesAutoresizingMaskIntoConstraints = false
+ return toolBar
+ }()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ setupUI()
+ }
+
+ private func setupUI() {
+ view.backgroundColor = .systemBackground
+
+ // 配置工具栏
+ let doneButton = UIBarButtonItem(title: "完成", style: .done, target: self, action: #selector(doneTapped))
+ let cancelButton = UIBarButtonItem(title: "取消", style: .plain, target: self, action: #selector(cancelTapped))
+ let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
+
+ toolbar.items = [cancelButton, flexibleSpace, doneButton]
+
+ // 配置 Picker
+ pickerView.delegate = self
+ pickerView.dataSource = self
+
+ // 添加子视图
+ view.addSubview(toolbar)
+ view.addSubview(pickerView)
+
+ // 设置约束
+ NSLayoutConstraint.activate([
+ toolbar.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
+ toolbar.leadingAnchor.constraint(equalTo: view.leadingAnchor),
+ toolbar.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+ toolbar.heightAnchor.constraint(equalToConstant: 44),
+
+ pickerView.topAnchor.constraint(equalTo: toolbar.bottomAnchor),
+ pickerView.leadingAnchor.constraint(equalTo: view.leadingAnchor),
+ pickerView.trailingAnchor.constraint(equalTo: view.trailingAnchor),
+ pickerView.bottomAnchor.constraint(equalTo: view.bottomAnchor)
+ ])
+ }
+
+ @objc private func doneTapped() {
+ let leftIndex = pickerView.selectedRow(inComponent: 0)
+ let rightIndex = pickerView.selectedRow(inComponent: 1)
+ onValuesSelected(leftOptions[leftIndex], rightOptions[rightIndex])
+ dismiss(animated: true)
+ }
+
+ @objc private func cancelTapped() {
+ onCancel()
+ dismiss(animated: true)
+ }
+}
+
+// 实现 PickerView 协议
+extension DoublePickerViewController: UIPickerViewDelegate, UIPickerViewDataSource {
+ func numberOfComponents(in pickerView: UIPickerView) -> Int {
+ return 2 // 两列
+ }
+
+ func pickerView(_ pickerView: UIPickerView, numberOfRowsInComponent component: Int) -> Int {
+ return component == 0 ? leftOptions.count : rightOptions.count
+ }
+
+ func pickerView(_ pickerView: UIPickerView, titleForRow row: Int, forComponent component: Int) -> String? {
+ return component == 0 ? "\(leftOptions[row])" : "\(rightOptions[row])"
+ }
+}
+
--- /dev/null
+//
+// DialogueViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+import UIKit
+import JoyGemAI
+import AVFoundation
+
+class DialogueMessageModel {
+
+ var message : String?
+ var translateMessage : String?
+ var current : Bool = false; //是否手机收音
+}
+
+class DialogueViewController: UIViewController {
+
+ var tableView : UITableView = UITableView(frame: CGRectZero, style: UITableView.Style.grouped)
+
+ var earStartButton : UIButton = UIButton(type: .custom)
+
+ var earStopButton : UIButton = UIButton(type: .custom)
+
+ var phoneStartButton : UIButton = UIButton(type: .custom)
+
+ var phoneStopButton : UIButton = UIButton(type: .custom)
+
+ var messageList : [DialogueMessageModel] = []
+
+ var tmpList : [(String,UInt)] = []
+
+ var tmpOtherList : [(String,UInt)] = []
+
+ var otherPcm : Data = Data()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "对话翻译"
+
+ view.addSubview(tableView)
+ tableView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.equalToSuperview()
+ make.trailing.equalToSuperview()
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-120)
+ }
+ tableView.backgroundColor = UIColor.yellow
+ tableView.delegate = self
+ tableView.dataSource = self
+
+ view.addSubview(phoneStartButton)
+ phoneStartButton.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-100)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(40)
+ make.width.equalTo(120)
+ }
+ phoneStartButton.setTitle("手机收音", for: .normal)
+ phoneStartButton.setTitleColor(UIColor.darkText, for: .normal)
+ phoneStartButton.addTarget(self, action: #selector(startPhoneRecord), for: .touchUpInside)
+
+// view.addSubview(phoneStopButton)
+// phoneStopButton.snp.makeConstraints { make in
+// make.top.equalTo(phoneStartButton.snp.bottom).offset(10)
+// make.centerX.equalToSuperview().multipliedBy(0.5)
+// make.height.equalTo(40)
+// make.width.equalTo(120)
+// }
+// phoneStopButton.setTitle("手机关闭收音", for: .normal)
+// phoneStopButton.setTitleColor(UIColor.darkText, for: .normal)
+// phoneStopButton.addTarget(self, action: #selector(stopPhoneRecord), for: .touchUpInside)
+
+ view.addSubview(earStartButton)
+ earStartButton.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-100)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(40)
+ make.width.equalTo(120)
+ }
+ earStartButton.setTitle("耳机收音", for: .normal)
+ earStartButton.setTitleColor(UIColor.darkText, for: .normal)
+ earStartButton.addTarget(self, action: #selector(startEarRecord), for: .touchUpInside)
+
+// view.addSubview(earStopButton)
+// earStopButton.snp.makeConstraints { make in
+// make.top.equalTo(phoneStopButton.snp.top)
+// make.centerX.equalToSuperview().multipliedBy(1.5)
+// make.height.equalTo(40)
+// make.width.equalTo(120)
+// }
+// earStopButton.setTitle("耳机关闭收音", for: .normal)
+// earStopButton.setTitleColor(UIColor.darkText, for: .normal)
+// earStopButton.addTarget(self, action: #selector(stopEarRecord), for: .touchUpInside)
+
+ JoyGemSIManager.shared().originalLanguage = kJoyGemAILocalizationZH
+ JoyGemSIManager.shared().targetLanguage = kJoyGemAILocalizationJA
+ JoyGemSIManager.shared().delegate = self
+
+ JoyGemSIDeviceManager.shared().originalLanguage = kJoyGemAILocalizationJA
+ JoyGemSIDeviceManager.shared().targetLanguage = kJoyGemAILocalizationZH
+ JoyGemSIDeviceManager.shared().delegate = self
+
+ PcmSound.sharedInstance().delegate = self;
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ do {
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+
+ @objc func startPhoneRecord() {
+
+ tmpList.removeAll()
+ tmpOtherList.removeAll()
+ let model = DialogueMessageModel()
+ model.current = true
+ messageList.append(model)
+ tableView.reloadData()
+ JoyGemSIManager.shared().start()
+ }
+
+ @objc func stopPhoneRecord() {
+ JoyGemSIManager.shared().stop()
+ }
+
+ @objc func startEarRecord() {
+ tmpList.removeAll()
+ tmpOtherList.removeAll()
+ let model = DialogueMessageModel()
+ model.current = false
+ messageList.append(model)
+ tableView.reloadData()
+ JoyGemSIDeviceManager.shared().start()
+ otherPcm = Data()
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playAndRecord, options: [.defaultToSpeaker])
+ try AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)
+ } catch {
+ print(error)
+ }
+ }
+
+ @objc func stopEarRecord() {
+ JoyGemSIDeviceManager.shared().stop()
+ //PcmSound.sharedInstance().feed(otherPcm)
+ }
+}
+
+// MARK: - UITableViewDataSource
+extension DialogueViewController: UITableViewDataSource,UITableViewDelegate {
+
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ return 60
+ }
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return messageList.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ var cell = tableView.dequeueReusableCell(withIdentifier: "cell")
+ if (cell == nil) {
+ cell = UITableViewCell(style: UITableViewCell.CellStyle.subtitle, reuseIdentifier: "cell")
+ }
+ let model = messageList[indexPath.row]
+ cell!.textLabel?.text = model.message
+ cell!.detailTextLabel?.text = model.translateMessage
+ if (model.current) {
+ cell!.backgroundColor = UIColor.gray
+ }else {
+ cell!.backgroundColor = UIColor.blue
+ }
+ return cell!
+ }
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+
+ }
+}
+
+extension DialogueViewController : JoyGemSIManagerDelegate {
+
+ func siManagerStopped(_ manager: JoyGemSIManager, reason code: JoyGemRecordStopCode) {
+
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateRaw model: JoyGemAsrModel) {
+ let msg = tmpList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ tmpList.append((model.text,model.index))
+ } else {
+ tmpList[msg!] = (model.text,model.index)
+ }
+
+ ///监听到一句话结束,自动结束当前录音
+ if (model.definite == true) {
+ stopPhoneRecord()
+ }
+
+ guard let model = messageList.last else {
+ return
+ }
+
+ model.message = tmpList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ tableView.reloadData()
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateTranslate model: JoyGemAsrModel) {
+ let msg = tmpOtherList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ tmpOtherList.append((model.text,model.index))
+ } else {
+ tmpOtherList[msg!] = (model.text,model.index)
+ }
+
+ guard let model = messageList.last else {
+ return
+ }
+
+ model.translateMessage = tmpOtherList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ tableView.reloadData()
+ }
+
+ func siManager(_ manager: JoyGemSIManager, saveFile path: String) {
+
+ }
+
+
+ func siManager(_ manager: JoyGemSIManager, stateChange code: JoyGemStateCode) {
+
+ }
+
+ func siManagerStopped(_ manager: JoyGemSIManager) {
+
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateAudioData data: Data) {
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func siManager(_ manager: JoyGemSIManager, onError code: JoyGemErrorCode) {
+
+ }
+}
+
+extension DialogueViewController : JoyGemSIDeviceManagerDelegate {
+
+ func siDeviceManagerStopped(_ manager: JoyGemSIDeviceManager, reason code: JoyGemRecordStopCode) {
+
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateRaw model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = tmpList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ tmpList.append((model.text,model.index))
+ } else {
+ tmpList[msg!] = (model.text,model.index)
+ }
+
+ ///监听到一句话结束,自动结束当前录音
+ if (model.definite == true) {
+ stopEarRecord()
+ }
+
+ guard let model = messageList.last else {
+ return
+ }
+
+ model.message = tmpList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ tableView.reloadData()
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateTranslate model: JoyGemAsrModel) {
+ let msg = tmpOtherList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ tmpOtherList.append((model.text,model.index))
+ } else {
+ tmpOtherList[msg!] = (model.text,model.index)
+ }
+
+ guard let model = messageList.last else {
+ return
+ }
+
+ model.translateMessage = tmpOtherList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ tableView.reloadData()
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, didUpdateAudioData data: Data) {
+ //otherPcm.append(data)
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, update mode: JoyGemRecordMode) {
+
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+ func siDeviceManager(_ manager: JoyGemSIDeviceManager, onError code: JoyGemErrorCode) {
+
+ }
+}
+
+
+extension DialogueViewController : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ debugPrint("[frame:\(frames)]");
+ }
+}
--- /dev/null
+//
+// Utils.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+import Foundation
+
+extension Data {
+
+ func joined(format: String = "%02x", _ separator: String = "") -> String {
+ self
+ .map { String(format: format, $0) }
+ .joined(separator: separator)
+ }
+
+ func reversedJoined(format: String = "%02x", _ separator: String = "") -> String {
+ self
+ .map { String(format: format, $0) }
+ .reversed()
+ .joined(separator: separator)
+ }
+
+ var int: Int {
+ self
+ .map { Int($0) }
+ .enumerated()
+ .map { $1 << ($0 * 8) }
+ .reduce(0, { partialResult, value in
+ partialResult | value
+ })
+ }
+}
+
+// UInt32 和 UInt16 的扩展,用于将数字转换为 Data
+extension FixedWidthInteger {
+ var data: Data {
+ var value = self.littleEndian
+ return Data(bytes: &value, count: MemoryLayout.size(ofValue: self))
+ }
+}
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>UIApplicationSceneManifest</key>
+ <dict>
+ <key>UIApplicationSupportsMultipleScenes</key>
+ <false/>
+ <key>UISceneConfigurations</key>
+ <dict>
+ <key>UIWindowSceneSessionRoleApplication</key>
+ <array>
+ <dict>
+ <key>UISceneConfigurationName</key>
+ <string>Default Configuration</string>
+ <key>UISceneDelegateClassName</key>
+ <string>$(PRODUCT_MODULE_NAME).SceneDelegate</string>
+ <key>UISceneStoryboardFile</key>
+ <string>Main</string>
+ </dict>
+ </array>
+ </dict>
+ </dict>
+ <key>UIBackgroundModes</key>
+ <array>
+ <string>bluetooth-peripheral</string>
+ <string>bluetooth-central</string>
+ <string>audio</string>
+ </array>
+</dict>
+</plist>
--- /dev/null
+//
+// Use this file to import your target's public headers that you would like to expose to Swift.
+//
+
+#import "PcmSound.h"
--- /dev/null
+//
+// ViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+import UIKit
+import JoyGemAI
+import CoreBluetooth
+import os.log
+import AVFoundation
+
+///主界面
+class MainViewController: UIViewController {
+
+ internal var tableView: UITableView!
+ private var cbManager: CBCentralManager!
+ private var cbState = CBManagerState.unknown
+
+ private var cbInfomations = [(CBPeripheral,[String : Any],NSNumber)]()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ title = "扫描设备"
+ // Do any additional setup after loading the view.
+ tableView = UITableView(frame: CGRectZero, style: UITableView.Style.grouped)
+ //tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "peripheralCell")
+ view.addSubview(tableView)
+ tableView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+
+ tableView.delegate = self
+ tableView.dataSource = self
+ tableView.reloadData()
+
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(scan)),
+ ]
+
+ //MARK: 初始化SDK
+ JoyGemAIManager.shared().initSdk()
+ //MARK: 配置日志类型
+ JoyGemAIManager.shared().setLogMode(JoyGemLogMode.all)
+
+ let fileManager = FileManager.default
+ if let appSupportDirectory = fileManager.urls(for: .applicationSupportDirectory, in: .userDomainMask).first {
+ let logDirectory = appSupportDirectory.appendingPathComponent("log")
+
+ // 检查 log 文件夹是否存在
+ if !fileManager.fileExists(atPath: logDirectory.path) {
+ do {
+ // 创建 log 文件夹
+ try fileManager.createDirectory(at: logDirectory, withIntermediateDirectories: true, attributes: nil)
+ print("log 文件夹已创建: \(logDirectory.path)")
+ } catch {
+ print("创建 log 文件夹时出错: \(error.localizedDescription)")
+ }
+ } else {
+ print("log 文件夹已存在: \(logDirectory.path)")
+ }
+
+ // 获取当前日期并格式化
+ let currentDate = Date()
+ let dateFormatter = DateFormatter()
+ dateFormatter.dateFormat = "yyyyMMddHHmmss"
+ let dateString = dateFormatter.string(from: currentDate)
+
+ // 创建日志文件名和路径
+ let fileName = "SDK_\(dateString).log"
+ let filePath = logDirectory.appendingPathComponent(fileName)
+
+ // 创建空文件
+ if !fileManager.fileExists(atPath: filePath.path) {
+ // 创建空文件
+ fileManager.createFile(atPath: filePath.path, contents: nil, attributes: nil)
+ print("日志文件已创建: \(filePath.path)")
+ } else {
+ print("日志文件已存在: \(filePath.path)")
+ }
+
+ //MARK: 配置日志路径
+ JoyGemAIManager.shared().setLogPath(filePath.path)
+ } else {
+ print("无法找到应用支持目录")
+ }
+
+ //MARK: 配置缓存路径
+ let tempPath = NSTemporaryDirectory();
+ JoyGemAIManager.shared().setCacheDirectory(tempPath)
+ JoyGemAIManager.shared().setTWSAutoSync(true)
+
+ cbManager = CBCentralManager(delegate: self, queue: nil)
+
+ }
+}
+
+// 扩展 String 来添加 padLeft 方法
+extension String {
+ func padLeft(toLength: Int, withPad pad: String) -> String {
+ let paddingCount = max(0, toLength - self.count)
+ return String(repeating: pad, count: paddingCount) + self
+ }
+}
+
+extension MainViewController: UITableViewDataSource,UITableViewDelegate {
+
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return cbInfomations.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ var cell = tableView.dequeueReusableCell(withIdentifier: "peripheralCell")
+ if (cell == nil) {
+ cell = UITableViewCell(style: .subtitle, reuseIdentifier: "peripheralCell")
+ }
+ cell!.textLabel?.text = "\(cbInfomations[indexPath.row].0.name ?? "CBPeripheral")"
+
+ if let advMsd = cbInfomations[indexPath.row].1[CBAdvertisementDataManufacturerDataKey] as? Data {
+ if (advMsd.count >= 13) {
+ let mac = advMsd[7...12];
+ cell!.detailTextLabel?.text = mac.map { String($0, radix: 16).padLeft(toLength: 2, withPad: "0") }.joined(separator: ":")
+ } else {
+ cell!.detailTextLabel?.text = nil;
+ }
+ } else {
+ cell!.detailTextLabel?.text = nil;
+ }
+
+ return cell!
+ }
+
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ return 66
+ }
+
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ let vc = PeripheralViewController()
+ vc.cbManager = cbManager
+ vc.currentPeripheral = cbInfomations[indexPath.row].0
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func scan() {
+ cbInfomations.removeAll()
+ tableView.reloadData()
+ cbManager.scanForPeripherals(withServices: [CBUUID(string: kJoyGemAIServiceUUID)],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+ //cbManager.scanForPeripherals(withServices: [],options: [CBCentralManagerScanOptionAllowDuplicatesKey : false])
+ }
+}
+
+extension MainViewController: CBCentralManagerDelegate {
+
+ func centralManagerDidUpdateState(_ central: CBCentralManager) {
+ // In your application, you would address each possible value of central.state and central.authorization
+ switch central.state {
+ case .resetting:
+ os_log("Connection with the system service was momentarily lost. Update imminent")
+ case .unsupported:
+ os_log("Platform does not support the Bluetooth Low Energy Central/Client role")
+ case .unauthorized:
+ switch CBManager.authorization {
+ case .restricted:
+ os_log("Bluetooth is restricted on this device")
+ case .denied:
+ os_log("The application is not authorized to use the Bluetooth Low Energy role")
+ default:
+ os_log("Something went wrong. Cleaning up cbManager")
+ }
+ case .poweredOff:
+ os_log("Bluetooth is currently powered off")
+ case .poweredOn:
+ os_log("Starting cbManager")
+ scan()
+ default:
+ os_log("Cleaning up cbManager")
+ }
+ }
+
+ func centralManager(_ central: CBCentralManager, didDiscover peripheral: CBPeripheral, advertisementData: [String : Any], rssi RSSI: NSNumber) {
+ cbInfomations.append((peripheral,advertisementData,RSSI))
+ tableView.reloadData()
+ }
+
+ func centralManager(_ central: CBCentralManager, connectionEventDidOccur event: CBConnectionEvent, for peripheral: CBPeripheral) {
+// os_log("connectionEventDidOccur for peripheral: %@", peripheral)
+// switch event {
+// case .peerConnected:
+// cbPeripherals.append(peripheral)
+// case .peerDisconnected:
+// os_log("Peer %@ disconnected!", peripheral)
+// default:
+// if let idx = cbPeripherals.firstIndex(where: { $0 === peripheral }) {
+// cbPeripherals.remove(at: idx)
+// }
+// }
+// tableView.reloadData()
+ }
+
+ func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
+ os_log("peripheral: %@ connected", peripheral)
+ }
+
+ func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
+ os_log("peripheral: %@ failed to connect", peripheral)
+ }
+
+ func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
+ os_log("peripheral: %@ disconnected", peripheral)
+ }
+}
--- /dev/null
+//
+// OtherViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+import UIKit
+import JoyGemAI
+import SVProgressHUD
+
+class OtherViewController: UIViewController {
+
+ internal var requestTextView : UITextView!
+ internal var responseTextView : UITextView!
+
+// let content = "A:喂,你好!是小红吗?\nB: 喂,是我!你是小明吧?最近怎么样?\nA: 挺好的!最近刚忙完工作,正想放松一下。你呢?\nB: 我也还不错!刚好最近有假期,正琢磨去哪儿玩呢。\nA: 太巧了!我正想问你呢,要不要一起出去旅游?\nB: 好啊!我正愁没人一起呢。你想去哪儿?\nA: 我听说云南最近天气特别好,丽江和大理风景超美,要不要去看看?\nB: 云南啊!我一直想去!不过那边海拔高,会不会有高原反应?\nA: 应该还好,我们慢慢适应就行。而且可以先去昆明过渡一下。\nB: 有道理!那咱们计划几天?五天够吗?\nA: 五天稍微有点紧,要不七天吧?可以玩得轻松点。\nB: 行!那咱们怎么安排行程?你想自由行还是跟团?\nA: 我倾向于自由行,自己安排时间更灵活。\nB: 我也是!那我来查查机票和民宿?\nA: 好啊,你负责住宿,我来规划路线,怎么样?\nB: 没问题!对了,咱们预算大概多少?\nA: 人均四五千应该够了吧?主要是机票和住宿。\nB: 差不多,我看看有没有优惠。\nA: 好!那咱们明天再碰一下具体细节?\nB: 好的,明天见!拜拜!\nA: 拜拜!"
+
+ let content = "喂,你好!\n喂,是我!最近怎么样?\n挺好的!最近刚忙完工作,正想放松一下。你呢?\n我也还不错!刚好最近有假期,正琢磨去哪儿玩呢。\n 太巧了!我正想问你呢,要不要一起出去旅游?\n好啊!我正愁没人一起呢。你想去哪儿?\n我听说云南最近天气特别好,丽江和大理风景超美,要不要去看看?\n云南啊!我一直想去!不过那边海拔高,会不会有高原反应?\n 应该还好,我们慢慢适应就行。而且可以先去昆明过渡一下。\n有道理!那咱们计划几天?五天够吗?\n五天稍微有点紧,要不七天吧?可以玩得轻松点。\n行!那咱们怎么安排行程?你想自由行还是跟团?\n 我倾向于自由行,自己安排时间更灵活。\n我也是!那我来查查机票和民宿?\n好啊,你负责住宿,我来规划路线,怎么样?\n没问题!对了,咱们预算大概多少?\n人均四五千应该够了吧?主要是机票和住宿。\n 差不多,我看看有没有优惠。\n好!那咱们明天再碰一下具体细节?\n好的,明天见!拜拜!\n拜拜!"
+
+ deinit {
+ cancelAction()
+ }
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = .white
+ title = "其它"
+
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "翻译", style: .done, target: self, action: #selector(translateAction)),
+ UIBarButtonItem(title: "摘要", style: .done, target: self, action: #selector(summaryAction)),
+ UIBarButtonItem(title: "取消", style: .done, target: self, action: #selector(cancelAction))
+ ]
+
+ requestTextView = UITextView()
+ view.addSubview(requestTextView)
+ requestTextView.backgroundColor = UIColor.gray
+ requestTextView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.snp.centerY).offset(-50)
+ }
+ responseTextView = UITextView()
+ view.addSubview(responseTextView)
+ responseTextView.backgroundColor = UIColor.yellow
+ responseTextView.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(requestTextView.snp.bottom)
+ make.height.equalTo(requestTextView.snp.height)
+ }
+ requestTextView.text = content
+ }
+
+ @objc func summaryAction() {
+
+ responseTextView.text = nil
+ JoyGemAIManager.shared().cancelSummaryRequest()
+
+ SVProgressHUD.show()
+ JoyGemAIManager.shared().summary(requestTextView.text) {[weak self] text, finish in
+ guard let self = self else{return}
+ self.responseTextView.text += text
+ if (finish) {
+ SVProgressHUD.dismiss()
+ }
+ } error: {[weak self] error in
+ guard let self = self else{return}
+ SVProgressHUD.dismiss()
+ self.responseTextView.text = error.debugDescription
+ }
+
+ }
+ @objc func translateAction() {
+
+ responseTextView.text = nil
+ JoyGemAIManager.shared().cancelTranslateRequest()
+
+ SVProgressHUD.show()
+ JoyGemAIManager.shared().translate(requestTextView.text, from: kJoyGemAILocalizationZH, to: kJoyGemAILocalizationEN) {[weak self] text, finish in
+ guard let self = self else{return}
+ self.responseTextView.text += text
+ if (finish) {
+ SVProgressHUD.dismiss()
+ }
+ } error: {[weak self] error in
+ guard let self = self else{return}
+ SVProgressHUD.dismiss()
+ self.responseTextView.text = error.debugDescription
+ }
+ }
+
+ @objc func cancelAction() {
+ JoyGemAIManager.shared().cancelSummaryRequest()
+ JoyGemAIManager.shared().cancelTranslateRequest()
+ }
+
+}
--- /dev/null
+
+
+#import <Foundation/Foundation.h>
+
+#define NAMESPACE @"pcm_sound"
+
+@protocol PcmSoundDelegate <NSObject>
+
+-(void)remaining:(NSUInteger)frames;
+
+@end
+
+@interface PcmSound : NSObject
+
++ (PcmSound*)sharedInstance;
+
+@property(nonatomic,weak) id<PcmSoundDelegate> delegate;
+
+-(BOOL)isPlaying;
+
+-(void)setLogLevel:(NSNumber*)logLevelNumber;
+
+-(void)setup:(int)sampleRate withchannels:(int)numChannels;
+
+-(void)feed:(NSData*)buffer;
+
+-(void)setFeedThreshold:(NSNumber*)feedThreshold;
+
+-(void)stopAudioUnit;
+
+- (void)cleanup;
+
+@end
--- /dev/null
+#import "PcmSound.h"
+#import <AudioToolbox/AudioToolbox.h>
+
+#if TARGET_OS_IOS
+#import <AVFoundation/AVFoundation.h>
+#endif
+
+#define kOutputBus 0
+#define NAMESPACE @"pcm_sound" // Assuming this is the namespace you want
+
+typedef NS_ENUM(NSUInteger, LogLevel) {
+ none = 0,
+ error = 1,
+ standard = 2,
+ verbose = 3,
+};
+
+@interface PcmSound ()
+@property(nonatomic) LogLevel mLogLevel;
+@property(nonatomic) AudioComponentInstance mAudioUnit;
+@property(nonatomic) NSMutableData *mSamples;
+@property(nonatomic) int mNumChannels;
+@property(nonatomic) int mFeedThreshold;
+@property(nonatomic) bool mDidInvokeFeedCallback;
+@end
+
+@implementation PcmSound
+
++ (instancetype)sharedInstance {
+ static PcmSound *sharedInstance = nil;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ sharedInstance = [[self alloc] init];
+ sharedInstance.mLogLevel = verbose;
+ sharedInstance.mSamples = [NSMutableData new];
+ sharedInstance.mFeedThreshold = 0;
+ sharedInstance.mDidInvokeFeedCallback = false;
+ });
+ return sharedInstance;
+}
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+
+ }
+ return self;
+}
+
+-(void)dealloc {
+
+}
+
+-(void)setLogLevel:(NSNumber*)logLevelNumber {
+ self.mLogLevel = (LogLevel)[logLevelNumber integerValue];
+}
+
+-(void)setup:(int)sampleRate withchannels:(int)numChannels {
+
+ self.mNumChannels = numChannels;
+
+ // cleanup
+ if (_mAudioUnit != nil) {
+ [self cleanup];
+ }
+
+ // create
+ AudioComponentDescription desc;
+ desc.componentType = kAudioUnitType_Output;
+#if TARGET_OS_IOS
+ desc.componentSubType = kAudioUnitSubType_RemoteIO;
+#else // MacOS
+ desc.componentSubType = kAudioUnitSubType_DefaultOutput;
+#endif
+ desc.componentFlags = 0;
+ desc.componentFlagsMask = 0;
+ desc.componentManufacturer = kAudioUnitManufacturer_Apple;
+
+ AudioComponent inputComponent = AudioComponentFindNext(NULL, &desc);
+ OSStatus status = AudioComponentInstanceNew(inputComponent, &_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioComponentInstanceNew failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // set stream format
+ AudioStreamBasicDescription audioFormat;
+ audioFormat.mSampleRate = sampleRate;
+ audioFormat.mFormatID = kAudioFormatLinearPCM;
+ audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
+ audioFormat.mFramesPerPacket = 1;
+ audioFormat.mChannelsPerFrame = self.mNumChannels;
+ audioFormat.mBitsPerChannel = 16;
+ audioFormat.mBytesPerFrame = self.mNumChannels * (audioFormat.mBitsPerChannel / 8);
+ audioFormat.mBytesPerPacket = audioFormat.mBytesPerFrame * audioFormat.mFramesPerPacket;
+
+ status = AudioUnitSetProperty(_mAudioUnit,
+ kAudioUnitProperty_StreamFormat,
+ kAudioUnitScope_Input,
+ kOutputBus,
+ &audioFormat,
+ sizeof(audioFormat));
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitSetProperty StreamFormat failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // set callback
+ AURenderCallbackStruct callback;
+ callback.inputProc = RenderCallback;
+ callback.inputProcRefCon = (__bridge void *)(self);
+
+ status = AudioUnitSetProperty(_mAudioUnit,
+ kAudioUnitProperty_SetRenderCallback,
+ kAudioUnitScope_Global,
+ kOutputBus,
+ &callback,
+ sizeof(callback));
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitSetProperty SetRenderCallback failed. OSStatus: %@", @(status)];
+ return;
+ }
+
+ // initialize
+ status = AudioUnitInitialize(_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitInitialize failed. OSStatus: %@", @(status)];
+ return;
+ }
+}
+
+-(void)feed:(NSData*)buffer {
+
+ @synchronized (self.mSamples) {
+ [self.mSamples appendData:buffer];
+ }
+
+ // reset
+ self.mDidInvokeFeedCallback = false;
+
+ // start playback if we can
+ if (_mAudioUnit != nil) {
+ UInt32 isPlaying = 0;
+ UInt32 size = sizeof(isPlaying);
+ OSStatus status = AudioUnitGetProperty(_mAudioUnit,
+ kAudioOutputUnitProperty_IsRunning,
+ kAudioUnitScope_Global,
+ 0,
+ &isPlaying,
+ &size);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioUnitGetProperty IsRunning failed. OSStatus: %@", @(status)];
+ return;
+ }
+ if (!isPlaying) {
+ status = AudioOutputUnitStart(_mAudioUnit);
+ if (status != noErr) {
+ //NSString* message = [NSString stringWithFormat:@"AudioOutputUnitStart failed. OSStatus: %@", @(status)];
+ return;
+ }
+ }
+ }
+}
+
+-(void)setFeedThreshold:(NSNumber*)feedThreshold {
+ self.mFeedThreshold = [feedThreshold intValue];
+}
+
+-(BOOL)isPlaying {
+ return self.mSamples.length > 0;
+}
+
+
+- (void)cleanup
+{
+ if (_mAudioUnit != nil) {
+ AudioUnitUninitialize(_mAudioUnit);
+ AudioComponentInstanceDispose(_mAudioUnit);
+ _mAudioUnit = nil;
+ }
+ @synchronized (self.mSamples) {
+ self.mSamples = [NSMutableData new];
+ }
+}
+
+- (void)stopAudioUnit
+{
+ if (_mAudioUnit != nil) {
+ UInt32 isRunning = 0;
+ UInt32 size = sizeof(isRunning);
+ OSStatus status = AudioUnitGetProperty(_mAudioUnit,
+ kAudioOutputUnitProperty_IsRunning,
+ kAudioUnitScope_Global,
+ 0,
+ &isRunning,
+ &size);
+ if (status != noErr) {
+ NSLog(@"AudioUnitGetProperty IsRunning failed. OSStatus: %@", @(status));
+ return;
+ }
+ if (isRunning) {
+ status = AudioOutputUnitStop(_mAudioUnit);
+ if (status != noErr) {
+ NSLog(@"AudioOutputUnitStop failed. OSStatus: %@", @(status));
+ } else {
+ NSLog(@"AudioUnit stopped because no more samples");
+ }
+ }
+ }
+}
+
+
+static OSStatus RenderCallback(void *inRefCon,
+ AudioUnitRenderActionFlags *ioActionFlags,
+ const AudioTimeStamp *inTimeStamp,
+ UInt32 inBusNumber,
+ UInt32 inNumberFrames,
+ AudioBufferList *ioData)
+{
+ PcmSound *instance = (__bridge PcmSound *)(inRefCon);
+
+ NSUInteger remainingFrames;
+ BOOL shouldRequestMore = false;
+
+ @synchronized (instance.mSamples) {
+
+ // clear
+ memset(ioData->mBuffers[0].mData, 0, ioData->mBuffers[0].mDataByteSize);
+
+ NSUInteger bytesToCopy = MIN(ioData->mBuffers[0].mDataByteSize, [instance.mSamples length]);
+
+ // provide samples
+ memcpy(ioData->mBuffers[0].mData, [instance.mSamples bytes], bytesToCopy);
+
+ // pop front bytes
+ NSRange range = NSMakeRange(0, bytesToCopy);
+ [instance.mSamples replaceBytesInRange:range withBytes:NULL length:0];
+
+ remainingFrames = [instance.mSamples length] / (instance.mNumChannels * sizeof(short));
+
+ // should request more frames?
+ shouldRequestMore = remainingFrames <= instance.mFeedThreshold && !instance.mDidInvokeFeedCallback;
+ }
+
+ // stop running, if needed
+ if (remainingFrames == 0) {
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [instance stopAudioUnit];
+ });
+ }
+
+ if (shouldRequestMore) {
+ instance.mDidInvokeFeedCallback = true;
+ //NSDictionary *response = @{@"remaining_frames": @(remainingFrames)};
+ dispatch_async(dispatch_get_main_queue(), ^{
+ if ([instance.delegate respondsToSelector:@selector(remaining:)]) {
+ [instance.delegate remaining:remainingFrames];
+ }
+ });
+ }
+
+ return noErr;
+}
+
+
+@end
--- /dev/null
+/*
+See the LICENSE.txt file for this sample’s licensing information.
+
+Abstract:
+A class to view details of a CBPeripheral.
+*/
+
+import CoreBluetooth
+import UIKit
+import os.log
+import AVFoundation
+import JoyGemAI
+import SVProgressHUD
+
+///设备功能界面
+class PeripheralViewController: UIViewController {
+
+ let list:[(name:String,action:String)] = [
+ ("AI对话","chatAction"),
+ ("现场录音","recordAction"),
+ ("通话录音(单声道)","callAction"),
+ ("通话录音(立体声)","stereoCallAction"),
+ ("同声传译","siAction"),
+ ("对话翻译","dialogueAction"),
+ ("配置","configAction"),
+ ("设备","deviceAction"),
+ ("其它","otherAction"),
+ ]
+
+ var tableView: UITableView!
+ var cbManager: CBCentralManager?
+
+ var currentPeripheral: CBPeripheral?
+
+ var writeCha : CBCharacteristic?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ title = "功能列表"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+
+ tableView = UITableView(frame: CGRectZero, style: UITableView.Style.grouped)
+ tableView.register(UITableViewCell.classForCoder(), forCellReuseIdentifier: "cell")
+ view.addSubview(tableView)
+ tableView.snp.makeConstraints { make in
+ make.edges.equalToSuperview()
+ }
+ tableView.dataSource = self
+ tableView.delegate = self
+
+ // Set peripheral delegate
+ currentPeripheral?.delegate = self
+ cbManager?.delegate = self
+
+ cbManager?.connect(currentPeripheral!, options: [CBConnectPeripheralOptionEnableTransportBridgingKey:true])
+ SVProgressHUD.show(withStatus: "连接中")
+
+ JoyGemAIManager.shared().delegate = self;
+ JoyGemAIManager.shared().dataSource = self;
+
+ }
+
+ // 自定义日期格式化器(静态实例提升性能)
+ private let dateFormatter: DateFormatter = {
+ let formatter = DateFormatter()
+ formatter.dateFormat = "yyyy-MM-dd HH:mm:ss.SSS"
+ return formatter
+ }()
+}
+
+extension PeripheralViewController : JoyGemAIManagerDelegate {
+
+
+ func joyGemAuthFailedCallback() {
+ SVProgressHUD.showInfo(withStatus: "鉴权失败")
+ }
+
+ func joyGemAuthSuccessCallback() {
+ SVProgressHUD.showInfo(withStatus: "鉴权成功")
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+
+ func joyGemAction(_ action: JoyGemActionMode) {
+ switch action {
+ case .cancel:
+ SVProgressHUD.showInfo(withStatus: "请求关闭录音功能/通知关闭了对话")
+ case .recordLive:
+ SVProgressHUD.showInfo(withStatus: "请求开启现场录音")
+ case .recordCall:
+ SVProgressHUD.showInfo(withStatus: "请求开启通话录音")
+ case .si:
+ SVProgressHUD.showInfo(withStatus: "请求开启同声传译")
+ case .chat:
+ SVProgressHUD.showInfo(withStatus: "通知开启了AI对话")
+ @unknown default:
+ break
+ }
+
+ }
+}
+
+
+//MARK: 蓝牙发送时需要
+extension PeripheralViewController : JoyGemAIManagerDataSource {
+
+ func joyGemSend(_ data: Data, with characteristic: CBCharacteristic) {
+ if (self.currentPeripheral != nil) {
+ self.currentPeripheral?.writeValue(data, for: characteristic, type: CBCharacteristicWriteType.withoutResponse)
+ }
+ }
+}
+
+
+extension PeripheralViewController: UITableViewDataSource,UITableViewDelegate {
+
+ func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
+ return 60
+ }
+
+ func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
+ return list.count
+ }
+
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
+ let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath)
+ cell.textLabel?.text = list[indexPath.row].name
+ return cell
+ }
+
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
+ let data = list[indexPath.row]
+ let action = Selector(data.action)
+ self.perform(action)
+ }
+
+ func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {
+ return "确保鉴权成功弹出以后再进入功能界面"
+ }
+
+}
+
+extension PeripheralViewController: CBCentralManagerDelegate {
+
+ func centralManagerDidUpdateState(_ central: CBCentralManager) {
+
+ }
+
+ func debugLog(_ items: Any..., separator: String = " ", terminator: String = "\n") {
+ let timestamp = dateFormatter.string(from: Date())
+ let prefix = "[\(timestamp)]"
+ debugPrint(prefix, items, separator: separator, terminator: terminator)
+ }
+
+ func centralManager(_ central: CBCentralManager, didConnect peripheral: CBPeripheral) {
+ debugLog("蓝牙连接成功")
+ peripheral.discoverServices([CBUUID(string: kJoyGemAIServiceUUID)]);
+ SVProgressHUD.show(withStatus: "鉴权中")
+ }
+
+ func centralManager(_ central: CBCentralManager, didFailToConnect peripheral: CBPeripheral, error: Error?) {
+ os_log("peripheral: %@ failed to connect", peripheral)
+ SVProgressHUD.dismiss()
+ }
+
+ func centralManager(_ central: CBCentralManager, didDisconnectPeripheral peripheral: CBPeripheral, error: Error?) {
+ //MARK: 设备断开连接时需要
+ JoyGemAIManager.shared().bleDisConnected();
+ SVProgressHUD.showError(withStatus: "蓝牙断开")
+ }
+}
+
+extension PeripheralViewController: CBPeripheralDelegate {
+
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverServices error: Error?) {
+
+ debugLog("发现服务成功")
+ for service in peripheral.services! {
+ os_log("peripheral service: %@", service)
+ peripheral.discoverCharacteristics(nil, for: service)
+ }
+
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didDiscoverCharacteristicsFor service: CBService, error: Error?) {
+
+ //MARK: 需要配置服务对象
+ if (service.uuid.uuidString == kJoyGemAIServiceUUID) {
+ let success = JoyGemAIManager.shared().configService(service) { chars in
+ for char in chars {
+ debugPrint(char)
+ peripheral.setNotifyValue(true, for: char)
+ }
+ }
+ if (!success) {
+ debugPrint("初始化失败!")
+ }
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateNotificationStateFor characteristic: CBCharacteristic, error: (any Error)?) {
+ if (characteristic.isNotifying == true && characteristic.service?.uuid.uuidString == kJoyGemAIServiceUUID && characteristic.uuid.uuidString == kJoyGemAICharacteristicNotifyUUID) {
+ //MARK: 使能成功时需要
+ debugLog("特征使能成功")
+ JoyGemAIManager.shared().bleConnected()
+ }
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didUpdateValueFor characteristic: CBCharacteristic, error: Error?) {
+ //MARK: 需要配置传入数据
+ JoyGemAIManager.shared().receiveValue(characteristic)
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didModifyServices invalidatedServices: [CBService]) {
+ // Accessory's GATT database has updated. Refresh your local cache (if any)
+ }
+
+ func peripheral(_ peripheral: CBPeripheral, didWriteValueFor characteristic: CBCharacteristic, error: (any Error)?) {
+
+ }
+
+}
+
+extension PeripheralViewController {
+
+ @objc func recordAction() {
+ //currentPeripheral?.discoverServices([CBUUID(string: kJoyGemAIServiceUUID)]);
+ let vc = RecordViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func callAction() {
+ guard JoyGemCallManager.shared().supportStereo == false else {
+ SVProgressHUD.showError(withStatus: "该设备为立体声设备")
+ return
+ }
+ let vc = CallViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func stereoCallAction() {
+ guard JoyGemCallManager.shared().supportStereo == true else {
+ SVProgressHUD.showError(withStatus: "该设备不支持立体声")
+ return
+ }
+ let vc = StereoCallViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func chatAction() {
+ let vc = ChatViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func siAction() {
+ let vc = SIViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func dialogueAction() {
+ let vc = DialogueViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func otherAction() {
+ let vc = OtherViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func configAction() {
+ let vc = ConfigViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+
+ @objc func deviceAction() {
+ let vc = DeviceViewController()
+ self.navigationController?.pushViewController(vc, animated: true)
+ }
+}
+
--- /dev/null
+//
+// RecordCallViewController.swift
+// JoyGemAIPod
+//
+// Created by jjjs on 2025/5/6.
+//
+
+import UIKit
+import SnapKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+
+class RecordCallViewController: UIViewController {
+
+ var textView : UITextView!
+
+ var startButton : UIButton!
+
+ var stopButton : UIButton!
+
+ var messageList : [(String,UInt)] = []
+
+ var recordFilePath : String?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "通话录音"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "播放录音", style: .done, target: self, action: #selector(playRecord))
+ ]
+
+ textView = UITextView()
+ view.addSubview(textView)
+ textView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-100)
+ }
+ textView.backgroundColor = UIColor.gray
+ startButton = UIButton(type: .custom)
+ view.addSubview(startButton)
+ startButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ startButton.setTitle("开始", for: .normal)
+ startButton.setTitleColor(UIColor.darkText, for: .normal)
+ startButton.addTarget(self, action: #selector(startRecord), for: .touchUpInside)
+
+ stopButton = UIButton(type: .custom)
+ view.addSubview(stopButton)
+ stopButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ stopButton.setTitle("结束", for: .normal)
+ stopButton.setTitleColor(UIColor.darkText, for: .normal)
+ stopButton.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
+
+ // Do any additional setup after loading the view.
+ JoyGemCallManager.shared().delegate = self
+ }
+
+ @objc func startRecord() {
+ messageList.removeAll()
+ textView.text = nil
+ JoyGemCallManager.shared().start()
+ }
+
+ @objc func endRecord() {
+ JoyGemCallManager.shared().stop()
+ }
+
+ var audioPlayer: AVAudioPlayer?
+
+ ///播放最后一次录音文件
+ @objc func playRecord() {
+ guard let file = recordFilePath else {return;}
+
+ do {
+ // 创建 AVAudioPlayer 实例
+ audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: file))
+ audioPlayer?.prepareToPlay() // 准备播放
+ audioPlayer?.play() // 播放音频
+ } catch {
+ debugPrint("播放音频时发生错误: \(error.localizedDescription)")
+ }
+ }
+
+}
+
+extension RecordCallViewController : JoyGemCallManagerDelegate {
+
+ func callManagerStopped(_ manager: JoyGemCallManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ SVProgressHUD.showInfo(withStatus: "用户主动结束")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "自动结束")
+ ///判断当前蓝牙是否连接从而确定是否因为蓝牙断开造成的录音断开
+ }
+ }
+
+ func callManagerNotonCall(_ manager: JoyGemCallManager) {
+ SVProgressHUD.showInfo(withStatus: "未处于通话状态")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func callManager(_ manager: JoyGemCallManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, onError code: JoyGemErrorCode) {
+
+ }
+
+ func callManager(_ manager: JoyGemCallManager, didUpdateAsr model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = messageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ messageList.append((model.text,model.index))
+ } else {
+ messageList[msg!] = (model.text,model.index)
+ }
+
+ textView.text = messageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+
+ func callManagerCompleted(_ manager: JoyGemCallManager) {
+ debugPrint("数据已全部接收")
+ }
+}
+
+
--- /dev/null
+//
+// RecordViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+import UIKit
+import SnapKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+//录音界面
+class RecordViewController: UIViewController {
+
+ var textView : UITextView!
+
+ var startButton : UIButton = UIButton(type: .custom)
+
+ var stopButton : UIButton = UIButton(type: .custom)
+
+ var pauseButton : UIButton = UIButton(type: .custom)
+
+ var resumeButton : UIButton = UIButton(type: .custom)
+
+ var messageList : [(String,UInt)] = []
+
+ var recordFilePath : String?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "录音"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "播放录音", style: .done, target: self, action: #selector(playRecord))
+ ]
+
+ textView = UITextView()
+ view.addSubview(textView)
+ textView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-200)
+ }
+ textView.backgroundColor = UIColor.gray
+
+ view.addSubview(startButton)
+ startButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ startButton.setTitle("开始", for: .normal)
+ startButton.setTitleColor(UIColor.darkText, for: .normal)
+ startButton.addTarget(self, action: #selector(startRecord), for: .touchUpInside)
+
+ view.addSubview(stopButton)
+ stopButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ stopButton.setTitle("结束", for: .normal)
+ stopButton.setTitleColor(UIColor.darkText, for: .normal)
+ stopButton.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
+
+ view.addSubview(pauseButton)
+ pauseButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(120)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ pauseButton.setTitle("暂停", for: .normal)
+ pauseButton.setTitleColor(UIColor.darkText, for: .normal)
+ pauseButton.addTarget(self, action: #selector(pauseRecord), for: .touchUpInside)
+
+ view.addSubview(resumeButton)
+ resumeButton.snp.makeConstraints { make in
+ make.top.equalTo(textView.snp.bottom).offset(120)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ resumeButton.setTitle("继续", for: .normal)
+ resumeButton.setTitleColor(UIColor.darkText, for: .normal)
+ resumeButton.addTarget(self, action: #selector(resumeRecord), for: .touchUpInside)
+
+ // Do any additional setup after loading the view.
+ JoyGemRecordManager.shared().delegate = self
+
+ PcmSound.sharedInstance().delegate = self;
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+ let options: AVAudioSession.CategoryOptions = [.allowBluetooth]
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback, options: [options])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ }
+
+ @objc func startRecord() {
+ messageList.removeAll()
+ textView.text = nil
+ JoyGemRecordManager.shared().originalLanguage = kJoyGemAILocalizationZH
+ JoyGemRecordManager.shared().start()
+ }
+
+ @objc func endRecord() {
+ JoyGemRecordManager.shared().stop()
+ }
+
+ @objc func pauseRecord() {
+ JoyGemRecordManager.shared().pause()
+ }
+
+ @objc func resumeRecord() {
+ JoyGemRecordManager.shared().resume()
+ }
+
+ var audioPlayer: AVAudioPlayer?
+
+ ///播放最后一次录音文件
+ @objc func playRecord() {
+ guard let file = recordFilePath else {return;}
+
+ do {
+ // 创建 AVAudioPlayer 实例v
+ audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: file))
+ audioPlayer?.prepareToPlay() // 准备播放
+ audioPlayer?.play() // 播放音频
+ } catch {
+ debugPrint("播放音频时发生错误: \(error.localizedDescription)")
+ }
+ }
+
+}
+
+extension RecordViewController : JoyGemRecordManagerDelegate {
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateAudioData data: Data) {
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateTranslate model: JoyGemAsrModel) {
+
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, didUpdateAsr model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = messageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ messageList.append((model.text,model.index))
+ } else {
+ messageList[msg!] = (model.text,model.index)
+ }
+
+ textView.text = messageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+
+
+ func recordManager(_ manager: JoyGemRecordManager, update mode: JoyGemRecordMode) {
+ debugPrint("mode: \(mode)")
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+
+ func recordManagerStopped(_ manager: JoyGemRecordManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ SVProgressHUD.showInfo(withStatus: "用户主动结束")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "自动结束")
+ ///判断当前蓝牙是否连接从而确定是否因为蓝牙断开造成的录音断开
+ }
+ }
+
+ func recordManager(_ manager: JoyGemRecordManager, onError code: JoyGemErrorCode) {
+
+ }
+}
+
+extension RecordViewController : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ debugPrint("[frame:\(frames)]");
+ }
+}
+
--- /dev/null
+//
+// SIViewController.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/21.
+//
+
+import UIKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+class SIViewController: UIViewController {
+
+ var textView : UITextView!
+ var translateTextView : UITextView!
+
+ var startButton : UIButton!
+
+ var stopButton : UIButton!
+
+ var messageList : [(String,UInt)] = []
+
+ var translateList : [(String,UInt)] = []
+
+ var recordFilePath : String?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "同声传译"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "播放录音", style: .done, target: self, action: #selector(playRecord))
+ ]
+
+ textView = UITextView()
+ view.addSubview(textView)
+ textView.backgroundColor = UIColor.gray
+ textView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.snp.centerY).offset(-50)
+ }
+ translateTextView = UITextView()
+ view.addSubview(translateTextView)
+ translateTextView.backgroundColor = UIColor.yellow
+ translateTextView.snp.makeConstraints { make in
+ make.leading.trailing.equalToSuperview()
+ make.top.equalTo(textView.snp.bottom)
+ make.height.equalTo(textView.snp.height)
+ }
+
+ startButton = UIButton(type: .custom)
+ view.addSubview(startButton)
+ startButton.snp.makeConstraints { make in
+ make.top.equalTo(translateTextView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ startButton.setTitle("开始", for: .normal)
+ startButton.setTitleColor(UIColor.darkText, for: .normal)
+ startButton.addTarget(self, action: #selector(startRecord), for: .touchUpInside)
+
+ stopButton = UIButton(type: .custom)
+ view.addSubview(stopButton)
+ stopButton.snp.makeConstraints { make in
+ make.top.equalTo(translateTextView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ stopButton.setTitle("结束", for: .normal)
+ stopButton.setTitleColor(UIColor.darkText, for: .normal)
+ stopButton.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
+
+ // Do any additional setup after loading the view.
+ JoyGemSIManager.shared().delegate = self
+
+ PcmSound.sharedInstance().delegate = self;
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playback)
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch {
+ print(error)
+ }
+ PcmSound.sharedInstance().setup(16000, withchannels: 1)
+
+
+ }
+
+ @objc func startRecord() {
+ messageList.removeAll()
+ translateList.removeAll()
+ textView.text = nil
+ translateTextView.text = nil
+
+ if Thread.isMainThread {
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .default, options: [])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch let error as NSError {
+ print("An error occurred setting the audio session category: \(error.localizedDescription)")
+ }
+ } else {
+ DispatchQueue.main.sync {
+ do {
+ try AVAudioSession.sharedInstance().setCategory(.playAndRecord, mode: .default, options: [])
+ try AVAudioSession.sharedInstance().setActive(true)
+ } catch let error as NSError {
+ print("An error occurred setting the audio session category: \(error.localizedDescription)")
+ }
+ }
+ }
+
+
+// do {
+// try AVAudioSession.sharedInstance().setCategory(.playAndRecord)
+// try AVAudioSession.sharedInstance().setActive(true)
+// } catch {
+// print(error)
+// }
+
+// try? AVAudioSession.sharedInstance().setCategory(AVAudioSession.Category.playAndRecord, mode: .default)
+// try? AVAudioSession.sharedInstance().setActive(true)
+ JoyGemSIManager.shared().originalLanguage = kJoyGemAILocalizationZH
+ JoyGemSIManager.shared().targetLanguage = kJoyGemAILocalizationJA
+ JoyGemSIManager.shared().start()
+ }
+
+ @objc func endRecord() {
+ JoyGemSIManager.shared().stop()
+ }
+
+ var audioPlayer: AVAudioPlayer?
+
+ ///播放最后一次录音文件
+ @objc func playRecord() {
+ guard let file = recordFilePath else {return;}
+ do {
+ // 创建 AVAudioPlayer 实例v
+
+ audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: file))
+ audioPlayer?.prepareToPlay() // 准备播放
+ audioPlayer?.play() // 播放音频
+ } catch {
+ debugPrint("播放音频时发生错误: \(error.localizedDescription)")
+ }
+ }
+}
+
+extension SIViewController : JoyGemSIManagerDelegate {
+
+ func siManagerStopped(_ manager: JoyGemSIManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ SVProgressHUD.showInfo(withStatus: "用户主动结束")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "用户被动结束")
+ }
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateRaw model: JoyGemAsrModel) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ let msg = messageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ messageList.append((model.text,model.index))
+ } else {
+ messageList[msg!] = (model.text,model.index)
+ }
+
+ textView.text = messageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateTranslate model: JoyGemAsrModel) {
+ debugPrint("translate text: \(model.text),index: \(model.index)")
+ let msg = translateList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ translateList.append((model.text,model.index))
+ } else {
+ translateList[msg!] = (model.text,model.index)
+ }
+
+ translateTextView.text = translateList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+
+
+ func siManager(_ manager: JoyGemSIManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func siManager(_ manager: JoyGemSIManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+ func siManager(_ manager: JoyGemSIManager, didUpdateAudioData data: Data) {
+ PcmSound.sharedInstance().feed(data)
+ }
+
+ func siManager(_ manager: JoyGemSIManager, onError code: JoyGemErrorCode) {
+
+ }
+}
+
+extension SIViewController : PcmSoundDelegate {
+
+ func remaining(_ frames: UInt) {
+ debugPrint("[frame:\(frames)]");
+ }
+}
--- /dev/null
+//
+// SceneDelegate.swift
+// JoyGemAIDemo
+//
+// Created by JoyGem on 2025/2/10.
+//
+
+import UIKit
+
+class SceneDelegate: UIResponder, UIWindowSceneDelegate {
+
+ var window: UIWindow?
+
+
+ func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
+ // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
+ // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
+ // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).
+ guard let _ = (scene as? UIWindowScene) else { return }
+
+ }
+
+ func sceneDidDisconnect(_ scene: UIScene) {
+ // Called as the scene is being released by the system.
+ // This occurs shortly after the scene enters the background, or when its session is discarded.
+ // Release any resources associated with this scene that can be re-created the next time the scene connects.
+ // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
+ }
+
+ func sceneDidBecomeActive(_ scene: UIScene) {
+ // Called when the scene has moved from an inactive state to an active state.
+ // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
+ }
+
+ func sceneWillResignActive(_ scene: UIScene) {
+ // Called when the scene will move from an active state to an inactive state.
+ // This may occur due to temporary interruptions (ex. an incoming phone call).
+ }
+
+ func sceneWillEnterForeground(_ scene: UIScene) {
+ // Called as the scene transitions from the background to the foreground.
+ // Use this method to undo the changes made on entering the background.
+ }
+
+ func sceneDidEnterBackground(_ scene: UIScene) {
+ // Called as the scene transitions from the foreground to the background.
+ // Use this method to save data, release shared resources, and store enough scene-specific state information
+ // to restore the scene back to its current state.
+ }
+
+
+}
+
--- /dev/null
+//
+// RecordCall2ViewController.swift
+// JoyGemAIPod
+//
+// Created by jjjs on 2025/7/19.
+//
+
+import UIKit
+import SnapKit
+import JoyGemAI
+import AVFoundation
+import SVProgressHUD
+
+
+class StereoCallViewController: UIViewController {
+
+ var selfTextView : UITextView!
+
+ var otherTextView : UITextView!
+
+ var startButton : UIButton!
+
+ var stopButton : UIButton!
+
+ var selfMessageList : [(String,UInt)] = []
+
+ var otherMessageList : [(String,UInt)] = []
+
+ var recordFilePath : String?
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+ view.backgroundColor = UIColor.white
+ title = "通话录音"
+
+ self.navigationController?.navigationBar.tintColor = UIColor.black
+ self.navigationItem.rightBarButtonItems = [
+ UIBarButtonItem(title: "播放录音", style: .done, target: self, action: #selector(playRecord))
+ ]
+
+ selfTextView = UITextView()
+ view.addSubview(selfTextView)
+ selfTextView.snp.makeConstraints { make in
+ make.top.equalTo(view.safeAreaLayoutGuide.snp.top)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.snp.centerY).offset(-50)
+ }
+ selfTextView.backgroundColor = UIColor.gray
+
+ otherTextView = UITextView()
+ view.addSubview(otherTextView)
+ otherTextView.snp.makeConstraints { make in
+ make.top.equalTo(selfTextView.snp.bottom)
+ make.leading.trailing.equalToSuperview()
+ make.bottom.equalTo(view.safeAreaLayoutGuide.snp.bottom).offset(-100)
+ }
+ otherTextView.backgroundColor = UIColor.yellow
+
+ startButton = UIButton(type: .custom)
+ view.addSubview(startButton)
+ startButton.snp.makeConstraints { make in
+ make.top.equalTo(otherTextView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(0.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ startButton.setTitle("开始", for: .normal)
+ startButton.setTitleColor(UIColor.darkText, for: .normal)
+ startButton.addTarget(self, action: #selector(startRecord), for: .touchUpInside)
+
+ stopButton = UIButton(type: .custom)
+ view.addSubview(stopButton)
+ stopButton.snp.makeConstraints { make in
+ make.top.equalTo(otherTextView.snp.bottom).offset(20)
+ make.centerX.equalToSuperview().multipliedBy(1.5)
+ make.height.equalTo(60)
+ make.width.equalTo(100)
+ }
+ stopButton.setTitle("结束", for: .normal)
+ stopButton.setTitleColor(UIColor.darkText, for: .normal)
+ stopButton.addTarget(self, action: #selector(endRecord), for: .touchUpInside)
+
+ // Do any additional setup after loading the view.
+ JoyGemCallManager.shared().delegate = self
+ JoyGemCallManager.shared().stereoDelegate = self
+ }
+
+ @objc func startRecord() {
+ selfMessageList.removeAll()
+ otherMessageList.removeAll()
+ selfTextView.text = nil
+ otherTextView.text = nil
+ JoyGemCallManager.shared().start()
+ }
+
+ @objc func endRecord() {
+ JoyGemCallManager.shared().stop()
+ }
+
+ var audioPlayer: AVAudioPlayer?
+
+ ///播放最后一次录音文件
+ @objc func playRecord() {
+ guard let file = recordFilePath else {return;}
+
+ do {
+ // 创建 AVAudioPlayer 实例
+ audioPlayer = try AVAudioPlayer(contentsOf: URL(fileURLWithPath: file))
+ audioPlayer?.prepareToPlay() // 准备播放
+ audioPlayer?.play() // 播放音频
+ } catch {
+ debugPrint("播放音频时发生错误: \(error.localizedDescription)")
+ }
+ }
+
+}
+
+extension StereoCallViewController : JoyGemCallManagerDelegate {
+
+ func callManagerStopped(_ manager: JoyGemCallManager, reason code: JoyGemRecordStopCode) {
+ if (code == .actively) {
+ SVProgressHUD.showInfo(withStatus: "用户主动结束")
+ } else {
+ SVProgressHUD.showInfo(withStatus: "自动结束")
+ ///判断当前蓝牙是否连接从而确定是否因为蓝牙断开造成的录音断开
+ }
+ }
+
+ func callManagerNotonCall(_ manager: JoyGemCallManager) {
+ SVProgressHUD.showInfo(withStatus: "未处于通话状态")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, saveFile path: String) {
+ debugPrint("path: \(path)")
+ recordFilePath = path
+ }
+
+ func callManager(_ manager: JoyGemCallManager, stateChange code: JoyGemStateCode) {
+ debugPrint("code: \(code)")
+ }
+
+ func callManager(_ manager: JoyGemCallManager, onError code: JoyGemErrorCode) {
+
+ }
+
+}
+
+extension StereoCallViewController : JoyGemCallStereoDelegate {
+
+ func callManager(_ manager: JoyGemCallManager, didUpdateStereoAsr model: JoyGemAsrModel, channel index: UInt) {
+ debugPrint("text: \(model.text),index: \(model.index)")
+ if (index == 1) {
+ let msg = self.selfMessageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ selfMessageList.append((model.text,model.index))
+ } else {
+ selfMessageList[msg!] = (model.text,model.index)
+ }
+
+ selfTextView.text = selfMessageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ } else if (index == 2) {
+ let msg = otherMessageList.firstIndex (where: { (str,idx) in
+ return idx == model.index;
+ })
+ if (msg == nil) {
+ otherMessageList.append((model.text,model.index))
+ } else {
+ otherMessageList[msg!] = (model.text,model.index)
+ }
+
+ otherTextView.text = otherMessageList.compactMap({ (str,idx) in
+ return str
+ }).joined(separator: "\n")
+ }
+ }
+
+}
+
--- /dev/null
+PODS:
+ - SnapKit (5.7.1)
+ - SocketRocket (0.7.1)
+ - SVProgressHUD (2.3.1):
+ - SVProgressHUD/Core (= 2.3.1)
+ - SVProgressHUD/Core (2.3.1)
+
+DEPENDENCIES:
+ - SnapKit (~> 5.7.0)
+ - SocketRocket
+ - SVProgressHUD
+
+SPEC REPOS:
+ https://gitee.com/mirrors/CocoaPods-Specs.git:
+ - SnapKit
+ - SocketRocket
+ - SVProgressHUD
+
+SPEC CHECKSUMS:
+ SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
+ SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
+ SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
+
+PODFILE CHECKSUM: 88e38ff2edfe5c4d422b709e72427b690a27bae3
+
+COCOAPODS: 1.16.1
--- /dev/null
+PODS:
+ - SnapKit (5.7.1)
+ - SocketRocket (0.7.1)
+ - SVProgressHUD (2.3.1):
+ - SVProgressHUD/Core (= 2.3.1)
+ - SVProgressHUD/Core (2.3.1)
+
+DEPENDENCIES:
+ - SnapKit (~> 5.7.0)
+ - SocketRocket
+ - SVProgressHUD
+
+SPEC REPOS:
+ https://gitee.com/mirrors/CocoaPods-Specs.git:
+ - SnapKit
+ - SocketRocket
+ - SVProgressHUD
+
+SPEC CHECKSUMS:
+ SnapKit: d612e99e678a2d3b95bf60b0705ed0a35c03484a
+ SocketRocket: d4aabe649be1e368d1318fdf28a022d714d65748
+ SVProgressHUD: 4837c74bdfe2e51e8821c397825996a8d7de6e22
+
+PODFILE CHECKSUM: 88e38ff2edfe5c4d422b709e72427b690a27bae3
+
+COCOAPODS: 1.16.1
--- /dev/null
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 71;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 0362BB03F32EC9FB6013DEE29E8E33EF /* SRHTTPConnectMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 6BA0FDB8F2FF7D242A9C04D637F9395D /* SRHTTPConnectMessage.m */; };
+ 04986EEC139DC7C45DAB58056315FDC8 /* SRPinningSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 078A1E3C0A17D73D5696661F2FD41355 /* SRPinningSecurityPolicy.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 064D909CD827405E8DCC309DB1B7775A /* ConstraintLayoutSupportDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = E1434BD4770B16AC5A1BA82148B7BFB4 /* ConstraintLayoutSupportDSL.swift */; };
+ 07632D281C5DED61CC7866B079BC9D2C /* SocketRocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 40E1C989D96D36B27BDFC28C0DF32C37 /* SocketRocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 09E1F569A93FAD4B9149E30B9301F44A /* ConstraintPriority.swift in Sources */ = {isa = PBXBuildFile; fileRef = AC43E26F2BCEC3F8A82A37251E167C22 /* ConstraintPriority.swift */; };
+ 0CA7A132ABE7018DE9295456732F38BB /* ConstraintAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = C911B2CF87A65C277D3130EE4D4FE64F /* ConstraintAttributes.swift */; };
+ 0DE5DB9C6227B3416778D8417DD95EA9 /* ConstraintView+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4EA184E57AC862564DDF1E17D31F0C15 /* ConstraintView+Extensions.swift */; };
+ 1194E62AA3F6F506799B1A43B16942B5 /* ConstraintDirectionalInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = F50E99CEE87D7FAD33334B05B6F32808 /* ConstraintDirectionalInsets.swift */; };
+ 14F6602F47FF59347CB6807CE217EDC5 /* SVProgressAnimatedView.h in Headers */ = {isa = PBXBuildFile; fileRef = BE1D7A8D31FE21DF99A4660B3D1AA623 /* SVProgressAnimatedView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 1739C4B63D12177E58B7110F21E939EB /* SVIndefiniteAnimatedView.h in Headers */ = {isa = PBXBuildFile; fileRef = A93277EC2270FDDAA0958C56E051C8B0 /* SVIndefiniteAnimatedView.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 1A117EC847E321871E40EB39F3576D11 /* SRDelegateController.m in Sources */ = {isa = PBXBuildFile; fileRef = 185F6DDECC4865237EB7C1AE1B31056D /* SRDelegateController.m */; };
+ 205EB01AED14BB574DD54EAFE26E4786 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */; };
+ 20B8C7C05E3AF3032935F30500EF5550 /* SRIOConsumerPool.m in Sources */ = {isa = PBXBuildFile; fileRef = EC5BE341F8DFE6872E5F64B48F725FC2 /* SRIOConsumerPool.m */; };
+ 2B2EB369550CE92CEEFCBFD3D32B8A3F /* ConstraintInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9E10254A0A8632CC477E958C7EC84BED /* ConstraintInsetTarget.swift */; };
+ 2B7184BD487141C385B3CC3F3984AA55 /* SRSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 31A63CD82C66679A09F23A5F4C655209 /* SRSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 3577F172FA68CBAE47CFEE6FE25C5404 /* ConstraintOffsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = AB861D7993575C07991739F9E7CA580E /* ConstraintOffsetTarget.swift */; };
+ 3BB0B5D924BE769E95E64A5E6FC1675D /* NSRunLoop+SRWebSocketPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C94F20D2970D27EE685FDD11155161C /* NSRunLoop+SRWebSocketPrivate.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 3D3B646B4988314275B40E97BEB16C7F /* ConstraintLayoutGuideDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50BA59410948826A90BFE7A40CDD335E /* ConstraintLayoutGuideDSL.swift */; };
+ 444E95921E2BDCE7512867EAA1A6B381 /* SRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = B907B14F3A53FFA2D4AC8BE9952962B7 /* SRWebSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 44EFA9A76932F81582D03076A8346A4B /* SRIOConsumerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 5C37DBED4411BB9A4E32119E2C48E33A /* SRIOConsumerPool.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 4DC15DC2DF3C4BBA344C86B112C9C68B /* SRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 97D9FEC2E67EC3B9B83E4A19175262BC /* SRWebSocket.m */; };
+ 4F4DEB687C0E4834A5B291DEE0651D6A /* ConstraintMaker.swift in Sources */ = {isa = PBXBuildFile; fileRef = 02380CEBB096C9215C757F7DD636E2F0 /* ConstraintMaker.swift */; };
+ 517CF33F75EA768ED4B7F0F440F54A7E /* SVRadialGradientLayer.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1355ED3E31B0CBC6851479974B00A6 /* SVRadialGradientLayer.m */; };
+ 56851E11140A140A15088A41DC4C33BD /* NSURLRequest+SRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 577FF168360656D8723DCA6C8A4FFE94 /* NSURLRequest+SRWebSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 57A34E19799F03EB53206496FD362449 /* SRURLUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 15F04AA9E58298DC3C28EEFD6F884C7B /* SRURLUtilities.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 57C4F6EFB30DDD14E960AC2D6B34F904 /* SnapKit-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = FC29B8849CE0100E7C6BE9C64A5AEB75 /* SnapKit-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 5922A6A0AE7152CF436356B3556F1835 /* ConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 325274FFB61CCB9521457A2368C080C8 /* ConstraintItem.swift */; };
+ 59F34874DA4ABB2F5C4E09EA6865936B /* ConstraintLayoutGuide.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EF4B6714D4E828DFCB3F41D6E2BDE5A /* ConstraintLayoutGuide.swift */; };
+ 5B67445AE2F3934BDA08D407BBA3028B /* SocketRocket-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = B9FD6FDF33FF7827E6C31546AB3EF28E /* SocketRocket-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 5DFD87881941225F0A5EAE64EB247708 /* SRSIMDHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = AEF784F41ECAE3C5470C7E86FEA09077 /* SRSIMDHelpers.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 5E7E257AE5D618E46EF57A5818010F85 /* NSRunLoop+SRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 919D3078BD5668ACA389A35AD945CFCB /* NSRunLoop+SRWebSocket.m */; };
+ 6037BA6633BDFF4F63D6C8B7C70D6160 /* SVProgressHUD-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = D5BAD163B18A86FA28BB1B7FCDFDD532 /* SVProgressHUD-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 6135798CCD656C1B3A6EA5738A23190A /* SRSIMDHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 11C7808696C7AD7D8B09BA7956749A18 /* SRSIMDHelpers.m */; };
+ 6464C345447C71904DA3706AACA3F55D /* SRProxyConnect.h in Headers */ = {isa = PBXBuildFile; fileRef = 20DCA1264B0FDE4CCC9B8EC324D8EC42 /* SRProxyConnect.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 65E5693A457A8AEE3E5758075D1E2792 /* SRError.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E80B99F422C47FAE83A9416F6E4DDC5 /* SRError.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 6645E9FB4265C5712E38055C931E1630 /* NSURLRequest+SRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 63E65DF20C67826C4F05933C9C548DE0 /* NSURLRequest+SRWebSocket.m */; };
+ 6680C3C8924C7503A6A54CF7A66BFF2F /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 66549C441E7F0958A782198C074E2397 /* QuartzCore.framework */; };
+ 6E39129FC8643A70C276801FEF4C280D /* Constraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = FFA751B020F380C639CC250AD104C26D /* Constraint.swift */; };
+ 7174D48AADABCBE6FC53185C5442B952 /* NSURLRequest+SRWebSocketPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = FDDAC95778CCFBCF273CB4E641A690E4 /* NSURLRequest+SRWebSocketPrivate.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 7804E0B3C98A2FE1E98AF544E88C9C3C /* SVRadialGradientLayer.h in Headers */ = {isa = PBXBuildFile; fileRef = 7486DB51AD52B7D323095BFD71CE0EE9 /* SVRadialGradientLayer.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 782981022BF319DFD85AE89A392639A2 /* SRMutex.h in Headers */ = {isa = PBXBuildFile; fileRef = B0DF85B6E4E98B26354EF0A3E5FEF528 /* SRMutex.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 7AF516B98D45391B909D507D0244104C /* ConstraintDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = 592FF48826615BAAA38B97FE20C85BB1 /* ConstraintDescription.swift */; };
+ 7B0DD32902633C7FF95B5745D8322BC3 /* SVProgressHUD.bundle in Resources */ = {isa = PBXBuildFile; fileRef = C982F402CB113B05D4B1F2A20FEE2040 /* SVProgressHUD.bundle */; };
+ 7D42390CDB4FA147504B03DA2A174A0C /* ConstraintViewDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0B0AF40C15008F0D0D92D22AE55A25CF /* ConstraintViewDSL.swift */; };
+ 7F30D73D46CAD9D21A25738B11A6DDDA /* SRURLUtilities.m in Sources */ = {isa = PBXBuildFile; fileRef = A45A1FC09B35C7FBB139B6D0B5BA9737 /* SRURLUtilities.m */; };
+ 868A9F524A7985BDA1EA124D9BF4CA63 /* ConstraintDSL.swift in Sources */ = {isa = PBXBuildFile; fileRef = D97B5B43639A927D54FB6F7B8CB5C5B0 /* ConstraintDSL.swift */; };
+ 86CAB01D950C8BC35EDE0BDC01A2500B /* ConstraintView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 587F92D0AE85CB263F1149F5AAEE7C77 /* ConstraintView.swift */; };
+ 883EDEE1C699497CF2A77C3B8A32A790 /* ConstraintMultiplierTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 19C76CB8A25B2C660EA75AFF6647676C /* ConstraintMultiplierTarget.swift */; };
+ 89717EC07E6324D3405867E754AE9131 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 23AD01048CEF57765D52B2EF4C55B397 /* PrivacyInfo.xcprivacy */; };
+ 89CAC1E5DC5833EE630A652957D253A7 /* SRLog.h in Headers */ = {isa = PBXBuildFile; fileRef = BF42198EDA662CDDE17107F36890BE2F /* SRLog.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 8BABA32F7B94A25D8E9208C0A8D90B2E /* ConstraintMakerRelatable+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 14501D25D8F6E2B505819E760BA65A1C /* ConstraintMakerRelatable+Extensions.swift */; };
+ 8D0D15CE4E92BA4433AE7EA578FE3E15 /* SRSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = C3650C85CE8A8BF1751F13A8A21CC5E4 /* SRSecurityPolicy.m */; };
+ 8D58E2EE938A4E604B325A740C6FE7C7 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */; };
+ 91930FDB4F9CCBBA9789806D1611AE6F /* SVProgressHUD.h in Headers */ = {isa = PBXBuildFile; fileRef = 8CBDE8068311F3F149733424E931B569 /* SVProgressHUD.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 92571FFBEF3A7B2F4F633624013010EE /* SRRunLoopThread.m in Sources */ = {isa = PBXBuildFile; fileRef = 64565DD0CD433588F260F50F66079582 /* SRRunLoopThread.m */; };
+ 939EE0216FC02064B2F5894E87628182 /* SRRunLoopThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 85943BDD2DEECD3663D3A3BC6D684C1C /* SRRunLoopThread.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 9A3761D8CEFB0E2131D2EFA2DEBB3A99 /* SRRandom.m in Sources */ = {isa = PBXBuildFile; fileRef = 89D9E3C762868F41C4BBA43E1778A7A5 /* SRRandom.m */; };
+ 9A3B9C740BC8FE0500132251551E5BE7 /* SRIOConsumer.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B7C748554BBA7785B4D717CD5C2FDB6 /* SRIOConsumer.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ 9E0045B41BFE697DB4ADE151228024D2 /* SnapKit_Privacy.bundle in Resources */ = {isa = PBXBuildFile; fileRef = B9DCB5EC0B1CDADD221717CADDF62359 /* SnapKit_Privacy.bundle */; };
+ 9FD199868823028AAB5681E3B7BFFB0E /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 67B95EC9E4D9AE5D31C8B2940A90B732 /* PrivacyInfo.xcprivacy */; };
+ A3585531EE4D8466B74A5A6F7958EC79 /* SocketRocket-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 90FCF59C1DB50D4CF155EDD7974926E4 /* SocketRocket-dummy.m */; };
+ A564D0B0EE8AED950D943A75C2B3092E /* SRMutex.m in Sources */ = {isa = PBXBuildFile; fileRef = EA2411F3FE4D90B6D9BBABF80B5D9331 /* SRMutex.m */; };
+ AABEF13464BA7F4621BD94736C1D057C /* ConstraintMakerPrioritizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 34A206653959B0FF746804314F156A55 /* ConstraintMakerPrioritizable.swift */; };
+ AB12501C57FFF722131F674ACB425944 /* SRError.m in Sources */ = {isa = PBXBuildFile; fileRef = E7774F4ADD0B69233B7E17979DF8D668 /* SRError.m */; };
+ ABC03808F32631C31667667948258ACE /* Pods-JoyGemAIDemo-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8A2D2C969321FF5F52A7272D95BCE8AC /* Pods-JoyGemAIDemo-dummy.m */; };
+ AE224EDB6D044C0FE86B086E950FC2F9 /* Debugging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2E93F5EB563B0B1709714E647C1240BF /* Debugging.swift */; };
+ AF760C78F1C7E11BF7CB9E9B29903530 /* ConstraintInsets.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30DD110DC4E53BA27955E28A74EBD7A3 /* ConstraintInsets.swift */; };
+ B0875E3AB8718E7DFE5C53497C02A15E /* ConstraintLayoutSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 874BE70592A52DF88EF06D6A66A9C38D /* ConstraintLayoutSupport.swift */; };
+ B2A6C2397B8ADAE4D7D64B09FF82570E /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */; };
+ B4C82668A78939FE910FEA0D314F06C1 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 054C080A56516E4ADDA7E9FEEA2D4FD5 /* Security.framework */; };
+ B543A1E1882CAEA19589891FCE2D17EA /* NSRunLoop+SRWebSocket.h in Headers */ = {isa = PBXBuildFile; fileRef = 76BE51A7A16AD25A516A8FE62021D0E1 /* NSRunLoop+SRWebSocket.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ B893C0DD5BE32FAE1D6895E1ED392B7A /* SRConstants.m in Sources */ = {isa = PBXBuildFile; fileRef = 938BD9979B42CBFEC37273BC9C37A48C /* SRConstants.m */; };
+ B903049E7C1BED7918DAB208754107C7 /* ConstraintMakerFinalizable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D10B0EB05AA6B997D5B0C2BD95B7F0D1 /* ConstraintMakerFinalizable.swift */; };
+ BA2FB695DEB0D179253EEB8DFCE3578B /* SnapKit-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = D78E01600A39734541D4990FC6683670 /* SnapKit-dummy.m */; };
+ BDA5C7CC91E86448237CF40954FAC5AF /* ConstraintMakerRelatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 08604283E18AF4DF7A4FD9107C1F37F3 /* ConstraintMakerRelatable.swift */; };
+ BF1AE4D97E813B95C43EA4A298B973D1 /* LayoutConstraint.swift in Sources */ = {isa = PBXBuildFile; fileRef = 594672ACD25BFC6E05E3BEDC0AFF20B6 /* LayoutConstraint.swift */; };
+ C07CB3E9A4D1BF00F841E4285629A2B2 /* ConstraintRelatableTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAC455D0F3897E6701EC5A5EC5169024 /* ConstraintRelatableTarget.swift */; };
+ C14F10B663FE2898EACAB90C202B3F50 /* ConstraintMakerEditable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D44C0360646EEB24281F3D089EED5703 /* ConstraintMakerEditable.swift */; };
+ C36214D8311B615CDA115276934926DC /* SRRandom.h in Headers */ = {isa = PBXBuildFile; fileRef = 4CB86616CD8D64DBA9773C30C3AA41D6 /* SRRandom.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ C6A4302ACE006C4E2CDD481287E2916B /* Typealiases.swift in Sources */ = {isa = PBXBuildFile; fileRef = F431F8514500EB417A0B5D57D7C66A41 /* Typealiases.swift */; };
+ C6F45595676957ADBEC18EB3F23EAEC4 /* LayoutConstraintItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8C289513B354447D46903A2D85C93AC8 /* LayoutConstraintItem.swift */; };
+ C92D93F48E74B79C08A2C5B81B68FD7D /* SRConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = CC5847BA2AD63E1B9FC7263CAB3E2498 /* SRConstants.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ CE593943A9E7CF83822CF60304BCAD43 /* ConstraintConstantTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3B4292820E37A984166EB251147A0C53 /* ConstraintConstantTarget.swift */; };
+ CEC96BA519484844D19338CC420C8808 /* SVIndefiniteAnimatedView.m in Sources */ = {isa = PBXBuildFile; fileRef = 24180F63622C3CEC513498B89CD16210 /* SVIndefiniteAnimatedView.m */; };
+ CF6554D8A9380CAC0F51D5043769D930 /* SRLog.m in Sources */ = {isa = PBXBuildFile; fileRef = 1BD1EE82BCA143564A9DEC60ADAC5504 /* SRLog.m */; };
+ D25185C12789EA624C8BAC6A6432E77B /* SRPinningSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 8381137A70938D1BBBB82AAFC63B0B1A /* SRPinningSecurityPolicy.m */; };
+ D2E460754683003AE9ECF32A831D401F /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C94130B86B411D191585E6A223C3C694 /* CFNetwork.framework */; };
+ D4218DA55B2BA45937589200CC0DF1FB /* ConstraintMakerExtendable.swift in Sources */ = {isa = PBXBuildFile; fileRef = D9EB218B2202FD67A414CBC2225522AC /* ConstraintMakerExtendable.swift */; };
+ D623A6CB33709C4D87766C66A756A0F7 /* SRProxyConnect.m in Sources */ = {isa = PBXBuildFile; fileRef = 19947805A4B09C6EE4C89FC2C66ADD61 /* SRProxyConnect.m */; };
+ DBA4803F4765E1650B8C6841157F5D73 /* ConstraintPriorityTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7DB8EF4BB696608C1219972EEA178A0 /* ConstraintPriorityTarget.swift */; };
+ DEEC14319D7619F96C4E93415A6D577D /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */; };
+ DF011D18EBB28ECE459B6D96D3E460D8 /* SRHTTPConnectMessage.h in Headers */ = {isa = PBXBuildFile; fileRef = 572E05997DDC55370C47ED497255D8D3 /* SRHTTPConnectMessage.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ E30E824D8CE04C815FAD7F424CF7C270 /* SVProgressAnimatedView.m in Sources */ = {isa = PBXBuildFile; fileRef = E5F8233915D247512F6DA3B1B822E8F1 /* SVProgressAnimatedView.m */; };
+ E37671A03B4C17A1CF3766A6125833BB /* ConstraintDirectionalInsetTarget.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5AFEE5E2D777166836C01E2C6AAD367 /* ConstraintDirectionalInsetTarget.swift */; };
+ E3D779DEE753C0B0D33BA8E73A980265 /* ConstraintLayoutGuide+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9EBE01132FEC7DFC40661AB6074C91B2 /* ConstraintLayoutGuide+Extensions.swift */; };
+ EB3BCE9B36BF814DA3069FA077168301 /* SRHash.m in Sources */ = {isa = PBXBuildFile; fileRef = EE49421E2F86071271A52B1FDC1BDD58 /* SRHash.m */; };
+ EC8DB2CC9791B7DC686DCC78EFBB56C5 /* SRDelegateController.h in Headers */ = {isa = PBXBuildFile; fileRef = 6C6A15EB1F466050C1436D7E1E47EAB1 /* SRDelegateController.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ ECC5C2ADC2682F9171FEA22AF10DCE53 /* ConstraintRelation.swift in Sources */ = {isa = PBXBuildFile; fileRef = D1B3D76A156161A20CEC3824B6B09CC8 /* ConstraintRelation.swift */; };
+ F6E948E2688CC08D3843DAA74F6328E8 /* SRHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 4C3A0C5D93DBB0A93DDFEEA897326433 /* SRHash.h */; settings = {ATTRIBUTES = (Project, ); }; };
+ F6F33E8B268F3D41075374D95B8088DC /* UILayoutSupport+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D360D2580F6F41C8ABE2606EB7A25C77 /* UILayoutSupport+Extensions.swift */; };
+ F87D4D6C6668A4AA86232BA3BDB9A178 /* SVProgressHUD.m in Sources */ = {isa = PBXBuildFile; fileRef = F88289484721B3C5C1115A55CB12EBB0 /* SVProgressHUD.m */; };
+ F9EBA65892D78A31C068D727D84BCB88 /* ConstraintConfig.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB5F0D1785B06919A2E028A38C5AF699 /* ConstraintConfig.swift */; };
+ FB75853E6A0E0682E1000CFBD293EBBC /* SVProgressHUD-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B03C9AC7EA6EBD11AA5CC20269FAF955 /* SVProgressHUD-dummy.m */; };
+ FBEDAA38D7E0B3C8DEE459EAA095C48C /* Pods-JoyGemAIDemo-umbrella.h in Headers */ = {isa = PBXBuildFile; fileRef = 4EE9B930126DDD3F7D558DDA0EC8A710 /* Pods-JoyGemAIDemo-umbrella.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ FCFC8D5B48F3DC4BC8942320631D8C1B /* SRIOConsumer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5560650533F07B36E06B6F96E4FFF307 /* SRIOConsumer.m */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 835DF671A580FED0D976A9BE52562532 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 1948D0B63D2CF6A48E18B0B292BC6091;
+ remoteInfo = SocketRocket;
+ };
+ A2037CAFBFB3B718C2AE2F4FB05B8705 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 1C8D67D8B72D6BA42CCEDB648537A340;
+ remoteInfo = SVProgressHUD;
+ };
+ C860B402EF6D807222EE55F2EA175448 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 8A8DB685241263AFDF5E6B20FE67B93A;
+ remoteInfo = "SnapKit-SnapKit_Privacy";
+ };
+ FD48D631BAD9713237222F94224B4230 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = BFDFE7DC352907FC980B868725387E98 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 19622742EBA51E823D6DAE3F8CDBFAD4;
+ remoteInfo = SnapKit;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXFileReference section */
+ 02380CEBB096C9215C757F7DD636E2F0 /* ConstraintMaker.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMaker.swift; path = Sources/ConstraintMaker.swift; sourceTree = "<group>"; };
+ 030FEB9982732056707F3135743826F1 /* Pods-JoyGemAIDemo-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-JoyGemAIDemo-frameworks.sh"; sourceTree = "<group>"; };
+ 054C080A56516E4ADDA7E9FEEA2D4FD5 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Security.framework; sourceTree = DEVELOPER_DIR; };
+ 078A1E3C0A17D73D5696661F2FD41355 /* SRPinningSecurityPolicy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRPinningSecurityPolicy.h; path = SocketRocket/Internal/Security/SRPinningSecurityPolicy.h; sourceTree = "<group>"; };
+ 08604283E18AF4DF7A4FD9107C1F37F3 /* ConstraintMakerRelatable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerRelatable.swift; path = Sources/ConstraintMakerRelatable.swift; sourceTree = "<group>"; };
+ 0B0AF40C15008F0D0D92D22AE55A25CF /* ConstraintViewDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintViewDSL.swift; path = Sources/ConstraintViewDSL.swift; sourceTree = "<group>"; };
+ 11C7808696C7AD7D8B09BA7956749A18 /* SRSIMDHelpers.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRSIMDHelpers.m; path = SocketRocket/Internal/Utilities/SRSIMDHelpers.m; sourceTree = "<group>"; };
+ 12B256489F57DB0D7209DFE5DDC0D705 /* Pods-JoyGemAIDemo.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = "Pods-JoyGemAIDemo.modulemap"; sourceTree = "<group>"; };
+ 14501D25D8F6E2B505819E760BA65A1C /* ConstraintMakerRelatable+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintMakerRelatable+Extensions.swift"; path = "Sources/ConstraintMakerRelatable+Extensions.swift"; sourceTree = "<group>"; };
+ 15F04AA9E58298DC3C28EEFD6F884C7B /* SRURLUtilities.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRURLUtilities.h; path = SocketRocket/Internal/Utilities/SRURLUtilities.h; sourceTree = "<group>"; };
+ 185F6DDECC4865237EB7C1AE1B31056D /* SRDelegateController.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRDelegateController.m; path = SocketRocket/Internal/Delegate/SRDelegateController.m; sourceTree = "<group>"; };
+ 19947805A4B09C6EE4C89FC2C66ADD61 /* SRProxyConnect.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRProxyConnect.m; path = SocketRocket/Internal/Proxy/SRProxyConnect.m; sourceTree = "<group>"; };
+ 19C76CB8A25B2C660EA75AFF6647676C /* ConstraintMultiplierTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMultiplierTarget.swift; path = Sources/ConstraintMultiplierTarget.swift; sourceTree = "<group>"; };
+ 1BD1EE82BCA143564A9DEC60ADAC5504 /* SRLog.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRLog.m; path = SocketRocket/Internal/Utilities/SRLog.m; sourceTree = "<group>"; };
+ 20DCA1264B0FDE4CCC9B8EC324D8EC42 /* SRProxyConnect.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRProxyConnect.h; path = SocketRocket/Internal/Proxy/SRProxyConnect.h; sourceTree = "<group>"; };
+ 23AD01048CEF57765D52B2EF4C55B397 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = SVProgressHUD/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
+ 24180F63622C3CEC513498B89CD16210 /* SVIndefiniteAnimatedView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SVIndefiniteAnimatedView.m; path = SVProgressHUD/SVIndefiniteAnimatedView.m; sourceTree = "<group>"; };
+ 2763F459D69C3B6B4108DE8ABA731567 /* SVProgressHUD.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SVProgressHUD.modulemap; sourceTree = "<group>"; };
+ 2E93F5EB563B0B1709714E647C1240BF /* Debugging.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Debugging.swift; path = Sources/Debugging.swift; sourceTree = "<group>"; };
+ 30DD110DC4E53BA27955E28A74EBD7A3 /* ConstraintInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsets.swift; path = Sources/ConstraintInsets.swift; sourceTree = "<group>"; };
+ 31A63CD82C66679A09F23A5F4C655209 /* SRSecurityPolicy.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRSecurityPolicy.h; path = SocketRocket/SRSecurityPolicy.h; sourceTree = "<group>"; };
+ 325274FFB61CCB9521457A2368C080C8 /* ConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintItem.swift; path = Sources/ConstraintItem.swift; sourceTree = "<group>"; };
+ 34A206653959B0FF746804314F156A55 /* ConstraintMakerPrioritizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerPrioritizable.swift; path = Sources/ConstraintMakerPrioritizable.swift; sourceTree = "<group>"; };
+ 38551E64867CE5BAFB66EC57CC2863F7 /* Pods-JoyGemAIDemo-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-JoyGemAIDemo-Info.plist"; sourceTree = "<group>"; };
+ 38A9A085D1DF5C3194ADEDC57264C009 /* SocketRocket-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SocketRocket-prefix.pch"; sourceTree = "<group>"; };
+ 3B4292820E37A984166EB251147A0C53 /* ConstraintConstantTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConstantTarget.swift; path = Sources/ConstraintConstantTarget.swift; sourceTree = "<group>"; };
+ 3EF4B6714D4E828DFCB3F41D6E2BDE5A /* ConstraintLayoutGuide.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuide.swift; path = Sources/ConstraintLayoutGuide.swift; sourceTree = "<group>"; };
+ 40E1C989D96D36B27BDFC28C0DF32C37 /* SocketRocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SocketRocket.h; path = SocketRocket/SocketRocket.h; sourceTree = "<group>"; };
+ 4B7C748554BBA7785B4D717CD5C2FDB6 /* SRIOConsumer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRIOConsumer.h; path = SocketRocket/Internal/IOConsumer/SRIOConsumer.h; sourceTree = "<group>"; };
+ 4C3A0C5D93DBB0A93DDFEEA897326433 /* SRHash.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRHash.h; path = SocketRocket/Internal/Utilities/SRHash.h; sourceTree = "<group>"; };
+ 4C94F20D2970D27EE685FDD11155161C /* NSRunLoop+SRWebSocketPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSRunLoop+SRWebSocketPrivate.h"; path = "SocketRocket/Internal/NSRunLoop+SRWebSocketPrivate.h"; sourceTree = "<group>"; };
+ 4CB86616CD8D64DBA9773C30C3AA41D6 /* SRRandom.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRRandom.h; path = SocketRocket/Internal/Utilities/SRRandom.h; sourceTree = "<group>"; };
+ 4E80B99F422C47FAE83A9416F6E4DDC5 /* SRError.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRError.h; path = SocketRocket/Internal/Utilities/SRError.h; sourceTree = "<group>"; };
+ 4EA184E57AC862564DDF1E17D31F0C15 /* ConstraintView+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintView+Extensions.swift"; path = "Sources/ConstraintView+Extensions.swift"; sourceTree = "<group>"; };
+ 4EE9B930126DDD3F7D558DDA0EC8A710 /* Pods-JoyGemAIDemo-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "Pods-JoyGemAIDemo-umbrella.h"; sourceTree = "<group>"; };
+ 50BA59410948826A90BFE7A40CDD335E /* ConstraintLayoutGuideDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutGuideDSL.swift; path = Sources/ConstraintLayoutGuideDSL.swift; sourceTree = "<group>"; };
+ 5560650533F07B36E06B6F96E4FFF307 /* SRIOConsumer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRIOConsumer.m; path = SocketRocket/Internal/IOConsumer/SRIOConsumer.m; sourceTree = "<group>"; };
+ 55E5E095252D79C57304FFB017BB0BC5 /* SVProgressHUD-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SVProgressHUD-Info.plist"; sourceTree = "<group>"; };
+ 572E05997DDC55370C47ED497255D8D3 /* SRHTTPConnectMessage.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRHTTPConnectMessage.h; path = SocketRocket/Internal/Utilities/SRHTTPConnectMessage.h; sourceTree = "<group>"; };
+ 577FF168360656D8723DCA6C8A4FFE94 /* NSURLRequest+SRWebSocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSURLRequest+SRWebSocket.h"; path = "SocketRocket/NSURLRequest+SRWebSocket.h"; sourceTree = "<group>"; };
+ 587F92D0AE85CB263F1149F5AAEE7C77 /* ConstraintView.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintView.swift; path = Sources/ConstraintView.swift; sourceTree = "<group>"; };
+ 592FF48826615BAAA38B97FE20C85BB1 /* ConstraintDescription.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDescription.swift; path = Sources/ConstraintDescription.swift; sourceTree = "<group>"; };
+ 594672ACD25BFC6E05E3BEDC0AFF20B6 /* LayoutConstraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraint.swift; path = Sources/LayoutConstraint.swift; sourceTree = "<group>"; };
+ 5C37DBED4411BB9A4E32119E2C48E33A /* SRIOConsumerPool.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRIOConsumerPool.h; path = SocketRocket/Internal/IOConsumer/SRIOConsumerPool.h; sourceTree = "<group>"; };
+ 62A9979254233B73B95007D708D1E25A /* SnapKit-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-prefix.pch"; sourceTree = "<group>"; };
+ 63E65DF20C67826C4F05933C9C548DE0 /* NSURLRequest+SRWebSocket.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSURLRequest+SRWebSocket.m"; path = "SocketRocket/NSURLRequest+SRWebSocket.m"; sourceTree = "<group>"; };
+ 64565DD0CD433588F260F50F66079582 /* SRRunLoopThread.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRRunLoopThread.m; path = SocketRocket/Internal/RunLoop/SRRunLoopThread.m; sourceTree = "<group>"; };
+ 66549C441E7F0958A782198C074E2397 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/QuartzCore.framework; sourceTree = DEVELOPER_DIR; };
+ 67B95EC9E4D9AE5D31C8B2940A90B732 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xml; name = PrivacyInfo.xcprivacy; path = Sources/PrivacyInfo.xcprivacy; sourceTree = "<group>"; };
+ 6BA0FDB8F2FF7D242A9C04D637F9395D /* SRHTTPConnectMessage.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRHTTPConnectMessage.m; path = SocketRocket/Internal/Utilities/SRHTTPConnectMessage.m; sourceTree = "<group>"; };
+ 6C6A15EB1F466050C1436D7E1E47EAB1 /* SRDelegateController.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRDelegateController.h; path = SocketRocket/Internal/Delegate/SRDelegateController.h; sourceTree = "<group>"; };
+ 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; };
+ 7486DB51AD52B7D323095BFD71CE0EE9 /* SVRadialGradientLayer.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SVRadialGradientLayer.h; path = SVProgressHUD/SVRadialGradientLayer.h; sourceTree = "<group>"; };
+ 76BE51A7A16AD25A516A8FE62021D0E1 /* NSRunLoop+SRWebSocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSRunLoop+SRWebSocket.h"; path = "SocketRocket/NSRunLoop+SRWebSocket.h"; sourceTree = "<group>"; };
+ 7BA73F09977C922C7B7FA7C0B234E9E3 /* SnapKit.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.release.xcconfig; sourceTree = "<group>"; };
+ 8381137A70938D1BBBB82AAFC63B0B1A /* SRPinningSecurityPolicy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRPinningSecurityPolicy.m; path = SocketRocket/Internal/Security/SRPinningSecurityPolicy.m; sourceTree = "<group>"; };
+ 85943BDD2DEECD3663D3A3BC6D684C1C /* SRRunLoopThread.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRRunLoopThread.h; path = SocketRocket/Internal/RunLoop/SRRunLoopThread.h; sourceTree = "<group>"; };
+ 85A01882ED06DFEA2E0CE78BCDB204A7 /* SocketRocket.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SocketRocket.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 874BE70592A52DF88EF06D6A66A9C38D /* ConstraintLayoutSupport.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupport.swift; path = Sources/ConstraintLayoutSupport.swift; sourceTree = "<group>"; };
+ 89D9E3C762868F41C4BBA43E1778A7A5 /* SRRandom.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRRandom.m; path = SocketRocket/Internal/Utilities/SRRandom.m; sourceTree = "<group>"; };
+ 8A2D2C969321FF5F52A7272D95BCE8AC /* Pods-JoyGemAIDemo-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-JoyGemAIDemo-dummy.m"; sourceTree = "<group>"; };
+ 8C289513B354447D46903A2D85C93AC8 /* LayoutConstraintItem.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = LayoutConstraintItem.swift; path = Sources/LayoutConstraintItem.swift; sourceTree = "<group>"; };
+ 8CBDE8068311F3F149733424E931B569 /* SVProgressHUD.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SVProgressHUD.h; path = SVProgressHUD/SVProgressHUD.h; sourceTree = "<group>"; };
+ 8D52542CF6C393E7708BED48E72DD679 /* Pods-JoyGemAIDemo-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-JoyGemAIDemo-acknowledgements.plist"; sourceTree = "<group>"; };
+ 8F23DB1C587B4583CD55800A55481EB6 /* SocketRocket.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SocketRocket.release.xcconfig; sourceTree = "<group>"; };
+ 90FCF59C1DB50D4CF155EDD7974926E4 /* SocketRocket-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SocketRocket-dummy.m"; sourceTree = "<group>"; };
+ 919D3078BD5668ACA389A35AD945CFCB /* NSRunLoop+SRWebSocket.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = "NSRunLoop+SRWebSocket.m"; path = "SocketRocket/NSRunLoop+SRWebSocket.m"; sourceTree = "<group>"; };
+ 925714E4666F0554718E983964951A8B /* SVProgressHUD.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SVProgressHUD.debug.xcconfig; sourceTree = "<group>"; };
+ 93096358FB9D70A7A7498BAA812CCA52 /* Pods-JoyGemAIDemo.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-JoyGemAIDemo.release.xcconfig"; sourceTree = "<group>"; };
+ 938BD9979B42CBFEC37273BC9C37A48C /* SRConstants.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRConstants.m; path = SocketRocket/Internal/SRConstants.m; sourceTree = "<group>"; };
+ 979486118B3E90C08386079D57962701 /* SnapKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SnapKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97D9FEC2E67EC3B9B83E4A19175262BC /* SRWebSocket.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRWebSocket.m; path = SocketRocket/SRWebSocket.m; sourceTree = "<group>"; };
+ 9A9313FF4398CEE1734CB6357724A7F1 /* Pods-JoyGemAIDemo.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-JoyGemAIDemo.debug.xcconfig"; sourceTree = "<group>"; };
+ 9B46A4A44CEAE7F06EDD05B954176D2C /* SVProgressHUD-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SVProgressHUD-prefix.pch"; sourceTree = "<group>"; };
+ 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; indentWidth = 2; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; tabWidth = 2; xcLanguageSpecificationIdentifier = xcode.lang.ruby; };
+ 9E10254A0A8632CC477E958C7EC84BED /* ConstraintInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintInsetTarget.swift; path = Sources/ConstraintInsetTarget.swift; sourceTree = "<group>"; };
+ 9EBE01132FEC7DFC40661AB6074C91B2 /* ConstraintLayoutGuide+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "ConstraintLayoutGuide+Extensions.swift"; path = "Sources/ConstraintLayoutGuide+Extensions.swift"; sourceTree = "<group>"; };
+ A45A1FC09B35C7FBB139B6D0B5BA9737 /* SRURLUtilities.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRURLUtilities.m; path = SocketRocket/Internal/Utilities/SRURLUtilities.m; sourceTree = "<group>"; };
+ A93277EC2270FDDAA0958C56E051C8B0 /* SVIndefiniteAnimatedView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SVIndefiniteAnimatedView.h; path = SVProgressHUD/SVIndefiniteAnimatedView.h; sourceTree = "<group>"; };
+ AB861D7993575C07991739F9E7CA580E /* ConstraintOffsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintOffsetTarget.swift; path = Sources/ConstraintOffsetTarget.swift; sourceTree = "<group>"; };
+ AC43E26F2BCEC3F8A82A37251E167C22 /* ConstraintPriority.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriority.swift; path = Sources/ConstraintPriority.swift; sourceTree = "<group>"; };
+ AEF784F41ECAE3C5470C7E86FEA09077 /* SRSIMDHelpers.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRSIMDHelpers.h; path = SocketRocket/Internal/Utilities/SRSIMDHelpers.h; sourceTree = "<group>"; };
+ B03C9AC7EA6EBD11AA5CC20269FAF955 /* SVProgressHUD-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SVProgressHUD-dummy.m"; sourceTree = "<group>"; };
+ B0DF85B6E4E98B26354EF0A3E5FEF528 /* SRMutex.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRMutex.h; path = SocketRocket/Internal/Utilities/SRMutex.h; sourceTree = "<group>"; };
+ B2B52318F57059FC39EB5115B64E4FCF /* SVProgressHUD.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SVProgressHUD.release.xcconfig; sourceTree = "<group>"; };
+ B907B14F3A53FFA2D4AC8BE9952962B7 /* SRWebSocket.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRWebSocket.h; path = SocketRocket/SRWebSocket.h; sourceTree = "<group>"; };
+ B9DCB5EC0B1CDADD221717CADDF62359 /* SnapKit_Privacy.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = SnapKit_Privacy.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
+ B9FD6FDF33FF7827E6C31546AB3EF28E /* SocketRocket-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SocketRocket-umbrella.h"; sourceTree = "<group>"; };
+ BAC455D0F3897E6701EC5A5EC5169024 /* ConstraintRelatableTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelatableTarget.swift; path = Sources/ConstraintRelatableTarget.swift; sourceTree = "<group>"; };
+ BE1D7A8D31FE21DF99A4660B3D1AA623 /* SVProgressAnimatedView.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SVProgressAnimatedView.h; path = SVProgressHUD/SVProgressAnimatedView.h; sourceTree = "<group>"; };
+ BF42198EDA662CDDE17107F36890BE2F /* SRLog.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRLog.h; path = SocketRocket/Internal/Utilities/SRLog.h; sourceTree = "<group>"; };
+ C3650C85CE8A8BF1751F13A8A21CC5E4 /* SRSecurityPolicy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRSecurityPolicy.m; path = SocketRocket/SRSecurityPolicy.m; sourceTree = "<group>"; };
+ C911B2CF87A65C277D3130EE4D4FE64F /* ConstraintAttributes.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintAttributes.swift; path = Sources/ConstraintAttributes.swift; sourceTree = "<group>"; };
+ C94130B86B411D191585E6A223C3C694 /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS18.0.sdk/System/Library/Frameworks/CFNetwork.framework; sourceTree = DEVELOPER_DIR; };
+ C982F402CB113B05D4B1F2A20FEE2040 /* SVProgressHUD.bundle */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = "wrapper.plug-in"; name = SVProgressHUD.bundle; path = SVProgressHUD/SVProgressHUD.bundle; sourceTree = "<group>"; };
+ CC293BBB9A5E4968EE4ED5F611BF8162 /* SocketRocket.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SocketRocket.debug.xcconfig; sourceTree = "<group>"; };
+ CC5847BA2AD63E1B9FC7263CAB3E2498 /* SRConstants.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = SRConstants.h; path = SocketRocket/Internal/SRConstants.h; sourceTree = "<group>"; };
+ CDBBCEA019AFD586193D94A34E344E7A /* Pods-JoyGemAIDemo-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-JoyGemAIDemo-acknowledgements.markdown"; sourceTree = "<group>"; };
+ D10B0EB05AA6B997D5B0C2BD95B7F0D1 /* ConstraintMakerFinalizable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerFinalizable.swift; path = Sources/ConstraintMakerFinalizable.swift; sourceTree = "<group>"; };
+ D137CAEEE2D408A7495FA50188CB4D52 /* SnapKit.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = SnapKit.debug.xcconfig; sourceTree = "<group>"; };
+ D1B3D76A156161A20CEC3824B6B09CC8 /* ConstraintRelation.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintRelation.swift; path = Sources/ConstraintRelation.swift; sourceTree = "<group>"; };
+ D360D2580F6F41C8ABE2606EB7A25C77 /* UILayoutSupport+Extensions.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = "UILayoutSupport+Extensions.swift"; path = "Sources/UILayoutSupport+Extensions.swift"; sourceTree = "<group>"; };
+ D44C0360646EEB24281F3D089EED5703 /* ConstraintMakerEditable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerEditable.swift; path = Sources/ConstraintMakerEditable.swift; sourceTree = "<group>"; };
+ D5AFEE5E2D777166836C01E2C6AAD367 /* ConstraintDirectionalInsetTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsetTarget.swift; path = Sources/ConstraintDirectionalInsetTarget.swift; sourceTree = "<group>"; };
+ D5BAD163B18A86FA28BB1B7FCDFDD532 /* SVProgressHUD-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SVProgressHUD-umbrella.h"; sourceTree = "<group>"; };
+ D78E01600A39734541D4990FC6683670 /* SnapKit-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "SnapKit-dummy.m"; sourceTree = "<group>"; };
+ D863F9DE61CFC7AA3F031CE3260FFE4D /* Pods_JoyGemAIDemo.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_JoyGemAIDemo.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ D97B5B43639A927D54FB6F7B8CB5C5B0 /* ConstraintDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDSL.swift; path = Sources/ConstraintDSL.swift; sourceTree = "<group>"; };
+ D9EB218B2202FD67A414CBC2225522AC /* ConstraintMakerExtendable.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintMakerExtendable.swift; path = Sources/ConstraintMakerExtendable.swift; sourceTree = "<group>"; };
+ DB5F0D1785B06919A2E028A38C5AF699 /* ConstraintConfig.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintConfig.swift; path = Sources/ConstraintConfig.swift; sourceTree = "<group>"; };
+ E1434BD4770B16AC5A1BA82148B7BFB4 /* ConstraintLayoutSupportDSL.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintLayoutSupportDSL.swift; path = Sources/ConstraintLayoutSupportDSL.swift; sourceTree = "<group>"; };
+ E5F8233915D247512F6DA3B1B822E8F1 /* SVProgressAnimatedView.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SVProgressAnimatedView.m; path = SVProgressHUD/SVProgressAnimatedView.m; sourceTree = "<group>"; };
+ E7774F4ADD0B69233B7E17979DF8D668 /* SRError.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRError.m; path = SocketRocket/Internal/Utilities/SRError.m; sourceTree = "<group>"; };
+ E7DB8EF4BB696608C1219972EEA178A0 /* ConstraintPriorityTarget.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintPriorityTarget.swift; path = Sources/ConstraintPriorityTarget.swift; sourceTree = "<group>"; };
+ E97D43C46A45EE515A4DA3AF94398441 /* SVProgressHUD.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = SVProgressHUD.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ EA2411F3FE4D90B6D9BBABF80B5D9331 /* SRMutex.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRMutex.m; path = SocketRocket/Internal/Utilities/SRMutex.m; sourceTree = "<group>"; };
+ EC5BE341F8DFE6872E5F64B48F725FC2 /* SRIOConsumerPool.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRIOConsumerPool.m; path = SocketRocket/Internal/IOConsumer/SRIOConsumerPool.m; sourceTree = "<group>"; };
+ ECDC2C14E25B69CE4704D7F90C1E36A0 /* SnapKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SnapKit-Info.plist"; sourceTree = "<group>"; };
+ EE1355ED3E31B0CBC6851479974B00A6 /* SVRadialGradientLayer.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SVRadialGradientLayer.m; path = SVProgressHUD/SVRadialGradientLayer.m; sourceTree = "<group>"; };
+ EE49421E2F86071271A52B1FDC1BDD58 /* SRHash.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SRHash.m; path = SocketRocket/Internal/Utilities/SRHash.m; sourceTree = "<group>"; };
+ F431F8514500EB417A0B5D57D7C66A41 /* Typealiases.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Typealiases.swift; path = Sources/Typealiases.swift; sourceTree = "<group>"; };
+ F50E99CEE87D7FAD33334B05B6F32808 /* ConstraintDirectionalInsets.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = ConstraintDirectionalInsets.swift; path = Sources/ConstraintDirectionalInsets.swift; sourceTree = "<group>"; };
+ F528C8C0205117E6E6107CE8AFF03E77 /* ResourceBundle-SnapKit_Privacy-SnapKit-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "ResourceBundle-SnapKit_Privacy-SnapKit-Info.plist"; sourceTree = "<group>"; };
+ F88289484721B3C5C1115A55CB12EBB0 /* SVProgressHUD.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = SVProgressHUD.m; path = SVProgressHUD/SVProgressHUD.m; sourceTree = "<group>"; };
+ F98682923B0BCA998E6618158F2101FB /* SocketRocket.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SocketRocket.modulemap; sourceTree = "<group>"; };
+ FC29B8849CE0100E7C6BE9C64A5AEB75 /* SnapKit-umbrella.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "SnapKit-umbrella.h"; sourceTree = "<group>"; };
+ FCE1C0E0C79D2C33462819FC7CA8AF38 /* SnapKit.modulemap */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.module; path = SnapKit.modulemap; sourceTree = "<group>"; };
+ FDDAC95778CCFBCF273CB4E641A690E4 /* NSURLRequest+SRWebSocketPrivate.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = "NSURLRequest+SRWebSocketPrivate.h"; path = "SocketRocket/Internal/NSURLRequest+SRWebSocketPrivate.h"; sourceTree = "<group>"; };
+ FE21277BF9017D281A07A338D5F51D92 /* SocketRocket-Info.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "SocketRocket-Info.plist"; sourceTree = "<group>"; };
+ FFA751B020F380C639CC250AD104C26D /* Constraint.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; name = Constraint.swift; path = Sources/Constraint.swift; sourceTree = "<group>"; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 33428AC36668E3ED52DB70316F843FB8 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 205EB01AED14BB574DD54EAFE26E4786 /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 4B4CD810BB6E6D719ECFED6C6CA9C997 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 58634B2196876B07B5310C7EACCF921E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B2A6C2397B8ADAE4D7D64B09FF82570E /* Foundation.framework in Frameworks */,
+ 6680C3C8924C7503A6A54CF7A66BFF2F /* QuartzCore.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 796567F81D938DA74DF71A2AFF3F8F3D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ D2E460754683003AE9ECF32A831D401F /* CFNetwork.framework in Frameworks */,
+ DEEC14319D7619F96C4E93415A6D577D /* Foundation.framework in Frameworks */,
+ B4C82668A78939FE910FEA0D314F06C1 /* Security.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8CBA52A0E5D17C5026C3C675B65FA403 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 8D58E2EE938A4E604B325A740C6FE7C7 /* Foundation.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 00234441CF7C8CCEE3F7647B94F6BDAC /* Core */ = {
+ isa = PBXGroup;
+ children = (
+ A93277EC2270FDDAA0958C56E051C8B0 /* SVIndefiniteAnimatedView.h */,
+ 24180F63622C3CEC513498B89CD16210 /* SVIndefiniteAnimatedView.m */,
+ BE1D7A8D31FE21DF99A4660B3D1AA623 /* SVProgressAnimatedView.h */,
+ E5F8233915D247512F6DA3B1B822E8F1 /* SVProgressAnimatedView.m */,
+ 8CBDE8068311F3F149733424E931B569 /* SVProgressHUD.h */,
+ F88289484721B3C5C1115A55CB12EBB0 /* SVProgressHUD.m */,
+ 7486DB51AD52B7D323095BFD71CE0EE9 /* SVRadialGradientLayer.h */,
+ EE1355ED3E31B0CBC6851479974B00A6 /* SVRadialGradientLayer.m */,
+ EBDCD60CA22CA04B2A7F8036D19F82BF /* Resources */,
+ );
+ name = Core;
+ sourceTree = "<group>";
+ };
+ 0165B987DA4D81EB7DFC7EAEBFAABFBB /* Support Files */ = {
+ isa = PBXGroup;
+ children = (
+ F528C8C0205117E6E6107CE8AFF03E77 /* ResourceBundle-SnapKit_Privacy-SnapKit-Info.plist */,
+ FCE1C0E0C79D2C33462819FC7CA8AF38 /* SnapKit.modulemap */,
+ D78E01600A39734541D4990FC6683670 /* SnapKit-dummy.m */,
+ ECDC2C14E25B69CE4704D7F90C1E36A0 /* SnapKit-Info.plist */,
+ 62A9979254233B73B95007D708D1E25A /* SnapKit-prefix.pch */,
+ FC29B8849CE0100E7C6BE9C64A5AEB75 /* SnapKit-umbrella.h */,
+ D137CAEEE2D408A7495FA50188CB4D52 /* SnapKit.debug.xcconfig */,
+ 7BA73F09977C922C7B7FA7C0B234E9E3 /* SnapKit.release.xcconfig */,
+ );
+ name = "Support Files";
+ path = "../Target Support Files/SnapKit";
+ sourceTree = "<group>";
+ };
+ 05509D3D469F558F8658F676D8E4BCA2 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 67B95EC9E4D9AE5D31C8B2940A90B732 /* PrivacyInfo.xcprivacy */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 11A5B8FCBF685FD503D053A5E1B57B5A /* SnapKit */ = {
+ isa = PBXGroup;
+ children = (
+ FFA751B020F380C639CC250AD104C26D /* Constraint.swift */,
+ C911B2CF87A65C277D3130EE4D4FE64F /* ConstraintAttributes.swift */,
+ DB5F0D1785B06919A2E028A38C5AF699 /* ConstraintConfig.swift */,
+ 3B4292820E37A984166EB251147A0C53 /* ConstraintConstantTarget.swift */,
+ 592FF48826615BAAA38B97FE20C85BB1 /* ConstraintDescription.swift */,
+ F50E99CEE87D7FAD33334B05B6F32808 /* ConstraintDirectionalInsets.swift */,
+ D5AFEE5E2D777166836C01E2C6AAD367 /* ConstraintDirectionalInsetTarget.swift */,
+ D97B5B43639A927D54FB6F7B8CB5C5B0 /* ConstraintDSL.swift */,
+ 30DD110DC4E53BA27955E28A74EBD7A3 /* ConstraintInsets.swift */,
+ 9E10254A0A8632CC477E958C7EC84BED /* ConstraintInsetTarget.swift */,
+ 325274FFB61CCB9521457A2368C080C8 /* ConstraintItem.swift */,
+ 3EF4B6714D4E828DFCB3F41D6E2BDE5A /* ConstraintLayoutGuide.swift */,
+ 9EBE01132FEC7DFC40661AB6074C91B2 /* ConstraintLayoutGuide+Extensions.swift */,
+ 50BA59410948826A90BFE7A40CDD335E /* ConstraintLayoutGuideDSL.swift */,
+ 874BE70592A52DF88EF06D6A66A9C38D /* ConstraintLayoutSupport.swift */,
+ E1434BD4770B16AC5A1BA82148B7BFB4 /* ConstraintLayoutSupportDSL.swift */,
+ 02380CEBB096C9215C757F7DD636E2F0 /* ConstraintMaker.swift */,
+ D44C0360646EEB24281F3D089EED5703 /* ConstraintMakerEditable.swift */,
+ D9EB218B2202FD67A414CBC2225522AC /* ConstraintMakerExtendable.swift */,
+ D10B0EB05AA6B997D5B0C2BD95B7F0D1 /* ConstraintMakerFinalizable.swift */,
+ 34A206653959B0FF746804314F156A55 /* ConstraintMakerPrioritizable.swift */,
+ 08604283E18AF4DF7A4FD9107C1F37F3 /* ConstraintMakerRelatable.swift */,
+ 14501D25D8F6E2B505819E760BA65A1C /* ConstraintMakerRelatable+Extensions.swift */,
+ 19C76CB8A25B2C660EA75AFF6647676C /* ConstraintMultiplierTarget.swift */,
+ AB861D7993575C07991739F9E7CA580E /* ConstraintOffsetTarget.swift */,
+ AC43E26F2BCEC3F8A82A37251E167C22 /* ConstraintPriority.swift */,
+ E7DB8EF4BB696608C1219972EEA178A0 /* ConstraintPriorityTarget.swift */,
+ BAC455D0F3897E6701EC5A5EC5169024 /* ConstraintRelatableTarget.swift */,
+ D1B3D76A156161A20CEC3824B6B09CC8 /* ConstraintRelation.swift */,
+ 587F92D0AE85CB263F1149F5AAEE7C77 /* ConstraintView.swift */,
+ 4EA184E57AC862564DDF1E17D31F0C15 /* ConstraintView+Extensions.swift */,
+ 0B0AF40C15008F0D0D92D22AE55A25CF /* ConstraintViewDSL.swift */,
+ 2E93F5EB563B0B1709714E647C1240BF /* Debugging.swift */,
+ 594672ACD25BFC6E05E3BEDC0AFF20B6 /* LayoutConstraint.swift */,
+ 8C289513B354447D46903A2D85C93AC8 /* LayoutConstraintItem.swift */,
+ F431F8514500EB417A0B5D57D7C66A41 /* Typealiases.swift */,
+ D360D2580F6F41C8ABE2606EB7A25C77 /* UILayoutSupport+Extensions.swift */,
+ 05509D3D469F558F8658F676D8E4BCA2 /* Resources */,
+ 0165B987DA4D81EB7DFC7EAEBFAABFBB /* Support Files */,
+ );
+ path = SnapKit;
+ sourceTree = "<group>";
+ };
+ 4AA169456C15955E80368C5E8742E9F7 /* iOS */ = {
+ isa = PBXGroup;
+ children = (
+ C94130B86B411D191585E6A223C3C694 /* CFNetwork.framework */,
+ 71F2AFDF205411E56316964DE08D951E /* Foundation.framework */,
+ 66549C441E7F0958A782198C074E2397 /* QuartzCore.framework */,
+ 054C080A56516E4ADDA7E9FEEA2D4FD5 /* Security.framework */,
+ );
+ name = iOS;
+ sourceTree = "<group>";
+ };
+ 5D86D48A3B789FF96DC016334C09ECA3 /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ D863F9DE61CFC7AA3F031CE3260FFE4D /* Pods_JoyGemAIDemo.framework */,
+ 979486118B3E90C08386079D57962701 /* SnapKit.framework */,
+ B9DCB5EC0B1CDADD221717CADDF62359 /* SnapKit_Privacy.bundle */,
+ 85A01882ED06DFEA2E0CE78BCDB204A7 /* SocketRocket.framework */,
+ E97D43C46A45EE515A4DA3AF94398441 /* SVProgressHUD.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 6E3F9B59595833EDA6318C22C7EBBDB9 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ 11A5B8FCBF685FD503D053A5E1B57B5A /* SnapKit */,
+ E1AEAAC4191A62736E2FBFE444D87516 /* SocketRocket */,
+ CC9E49E184BF8389723846DDD7CC17F2 /* SVProgressHUD */,
+ );
+ name = Pods;
+ sourceTree = "<group>";
+ };
+ 70AEC151BB5CE1548F08FB4893DCF675 /* Pods-JoyGemAIDemo */ = {
+ isa = PBXGroup;
+ children = (
+ 12B256489F57DB0D7209DFE5DDC0D705 /* Pods-JoyGemAIDemo.modulemap */,
+ CDBBCEA019AFD586193D94A34E344E7A /* Pods-JoyGemAIDemo-acknowledgements.markdown */,
+ 8D52542CF6C393E7708BED48E72DD679 /* Pods-JoyGemAIDemo-acknowledgements.plist */,
+ 8A2D2C969321FF5F52A7272D95BCE8AC /* Pods-JoyGemAIDemo-dummy.m */,
+ 030FEB9982732056707F3135743826F1 /* Pods-JoyGemAIDemo-frameworks.sh */,
+ 38551E64867CE5BAFB66EC57CC2863F7 /* Pods-JoyGemAIDemo-Info.plist */,
+ 4EE9B930126DDD3F7D558DDA0EC8A710 /* Pods-JoyGemAIDemo-umbrella.h */,
+ 9A9313FF4398CEE1734CB6357724A7F1 /* Pods-JoyGemAIDemo.debug.xcconfig */,
+ 93096358FB9D70A7A7498BAA812CCA52 /* Pods-JoyGemAIDemo.release.xcconfig */,
+ );
+ name = "Pods-JoyGemAIDemo";
+ path = "Target Support Files/Pods-JoyGemAIDemo";
+ sourceTree = "<group>";
+ };
+ 97120ED64FDA93A6C940E065CB7FAB64 /* Support Files */ = {
+ isa = PBXGroup;
+ children = (
+ 2763F459D69C3B6B4108DE8ABA731567 /* SVProgressHUD.modulemap */,
+ B03C9AC7EA6EBD11AA5CC20269FAF955 /* SVProgressHUD-dummy.m */,
+ 55E5E095252D79C57304FFB017BB0BC5 /* SVProgressHUD-Info.plist */,
+ 9B46A4A44CEAE7F06EDD05B954176D2C /* SVProgressHUD-prefix.pch */,
+ D5BAD163B18A86FA28BB1B7FCDFDD532 /* SVProgressHUD-umbrella.h */,
+ 925714E4666F0554718E983964951A8B /* SVProgressHUD.debug.xcconfig */,
+ B2B52318F57059FC39EB5115B64E4FCF /* SVProgressHUD.release.xcconfig */,
+ );
+ name = "Support Files";
+ path = "../Target Support Files/SVProgressHUD";
+ sourceTree = "<group>";
+ };
+ BA4F31F07263C99FC76E66D632A59F09 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ 4AA169456C15955E80368C5E8742E9F7 /* iOS */,
+ );
+ name = Frameworks;
+ sourceTree = "<group>";
+ };
+ BD049C321EB08EF29E658A3CBFC71BFE /* Support Files */ = {
+ isa = PBXGroup;
+ children = (
+ F98682923B0BCA998E6618158F2101FB /* SocketRocket.modulemap */,
+ 90FCF59C1DB50D4CF155EDD7974926E4 /* SocketRocket-dummy.m */,
+ FE21277BF9017D281A07A338D5F51D92 /* SocketRocket-Info.plist */,
+ 38A9A085D1DF5C3194ADEDC57264C009 /* SocketRocket-prefix.pch */,
+ B9FD6FDF33FF7827E6C31546AB3EF28E /* SocketRocket-umbrella.h */,
+ CC293BBB9A5E4968EE4ED5F611BF8162 /* SocketRocket.debug.xcconfig */,
+ 8F23DB1C587B4583CD55800A55481EB6 /* SocketRocket.release.xcconfig */,
+ );
+ name = "Support Files";
+ path = "../Target Support Files/SocketRocket";
+ sourceTree = "<group>";
+ };
+ CC9E49E184BF8389723846DDD7CC17F2 /* SVProgressHUD */ = {
+ isa = PBXGroup;
+ children = (
+ 00234441CF7C8CCEE3F7647B94F6BDAC /* Core */,
+ 97120ED64FDA93A6C940E065CB7FAB64 /* Support Files */,
+ );
+ path = SVProgressHUD;
+ sourceTree = "<group>";
+ };
+ CF1408CF629C7361332E53B88F7BD30C = {
+ isa = PBXGroup;
+ children = (
+ 9D940727FF8FB9C785EB98E56350EF41 /* Podfile */,
+ BA4F31F07263C99FC76E66D632A59F09 /* Frameworks */,
+ 6E3F9B59595833EDA6318C22C7EBBDB9 /* Pods */,
+ 5D86D48A3B789FF96DC016334C09ECA3 /* Products */,
+ FD4740BF40336DE04AC6CC902566FD50 /* Targets Support Files */,
+ );
+ sourceTree = "<group>";
+ };
+ E1AEAAC4191A62736E2FBFE444D87516 /* SocketRocket */ = {
+ isa = PBXGroup;
+ children = (
+ 76BE51A7A16AD25A516A8FE62021D0E1 /* NSRunLoop+SRWebSocket.h */,
+ 919D3078BD5668ACA389A35AD945CFCB /* NSRunLoop+SRWebSocket.m */,
+ 4C94F20D2970D27EE685FDD11155161C /* NSRunLoop+SRWebSocketPrivate.h */,
+ 577FF168360656D8723DCA6C8A4FFE94 /* NSURLRequest+SRWebSocket.h */,
+ 63E65DF20C67826C4F05933C9C548DE0 /* NSURLRequest+SRWebSocket.m */,
+ FDDAC95778CCFBCF273CB4E641A690E4 /* NSURLRequest+SRWebSocketPrivate.h */,
+ 40E1C989D96D36B27BDFC28C0DF32C37 /* SocketRocket.h */,
+ CC5847BA2AD63E1B9FC7263CAB3E2498 /* SRConstants.h */,
+ 938BD9979B42CBFEC37273BC9C37A48C /* SRConstants.m */,
+ 6C6A15EB1F466050C1436D7E1E47EAB1 /* SRDelegateController.h */,
+ 185F6DDECC4865237EB7C1AE1B31056D /* SRDelegateController.m */,
+ 4E80B99F422C47FAE83A9416F6E4DDC5 /* SRError.h */,
+ E7774F4ADD0B69233B7E17979DF8D668 /* SRError.m */,
+ 4C3A0C5D93DBB0A93DDFEEA897326433 /* SRHash.h */,
+ EE49421E2F86071271A52B1FDC1BDD58 /* SRHash.m */,
+ 572E05997DDC55370C47ED497255D8D3 /* SRHTTPConnectMessage.h */,
+ 6BA0FDB8F2FF7D242A9C04D637F9395D /* SRHTTPConnectMessage.m */,
+ 4B7C748554BBA7785B4D717CD5C2FDB6 /* SRIOConsumer.h */,
+ 5560650533F07B36E06B6F96E4FFF307 /* SRIOConsumer.m */,
+ 5C37DBED4411BB9A4E32119E2C48E33A /* SRIOConsumerPool.h */,
+ EC5BE341F8DFE6872E5F64B48F725FC2 /* SRIOConsumerPool.m */,
+ BF42198EDA662CDDE17107F36890BE2F /* SRLog.h */,
+ 1BD1EE82BCA143564A9DEC60ADAC5504 /* SRLog.m */,
+ B0DF85B6E4E98B26354EF0A3E5FEF528 /* SRMutex.h */,
+ EA2411F3FE4D90B6D9BBABF80B5D9331 /* SRMutex.m */,
+ 078A1E3C0A17D73D5696661F2FD41355 /* SRPinningSecurityPolicy.h */,
+ 8381137A70938D1BBBB82AAFC63B0B1A /* SRPinningSecurityPolicy.m */,
+ 20DCA1264B0FDE4CCC9B8EC324D8EC42 /* SRProxyConnect.h */,
+ 19947805A4B09C6EE4C89FC2C66ADD61 /* SRProxyConnect.m */,
+ 4CB86616CD8D64DBA9773C30C3AA41D6 /* SRRandom.h */,
+ 89D9E3C762868F41C4BBA43E1778A7A5 /* SRRandom.m */,
+ 85943BDD2DEECD3663D3A3BC6D684C1C /* SRRunLoopThread.h */,
+ 64565DD0CD433588F260F50F66079582 /* SRRunLoopThread.m */,
+ 31A63CD82C66679A09F23A5F4C655209 /* SRSecurityPolicy.h */,
+ C3650C85CE8A8BF1751F13A8A21CC5E4 /* SRSecurityPolicy.m */,
+ AEF784F41ECAE3C5470C7E86FEA09077 /* SRSIMDHelpers.h */,
+ 11C7808696C7AD7D8B09BA7956749A18 /* SRSIMDHelpers.m */,
+ 15F04AA9E58298DC3C28EEFD6F884C7B /* SRURLUtilities.h */,
+ A45A1FC09B35C7FBB139B6D0B5BA9737 /* SRURLUtilities.m */,
+ B907B14F3A53FFA2D4AC8BE9952962B7 /* SRWebSocket.h */,
+ 97D9FEC2E67EC3B9B83E4A19175262BC /* SRWebSocket.m */,
+ BD049C321EB08EF29E658A3CBFC71BFE /* Support Files */,
+ );
+ path = SocketRocket;
+ sourceTree = "<group>";
+ };
+ EBDCD60CA22CA04B2A7F8036D19F82BF /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 23AD01048CEF57765D52B2EF4C55B397 /* PrivacyInfo.xcprivacy */,
+ C982F402CB113B05D4B1F2A20FEE2040 /* SVProgressHUD.bundle */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ FD4740BF40336DE04AC6CC902566FD50 /* Targets Support Files */ = {
+ isa = PBXGroup;
+ children = (
+ 70AEC151BB5CE1548F08FB4893DCF675 /* Pods-JoyGemAIDemo */,
+ );
+ name = "Targets Support Files";
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 5B1500FE995B9224E0AF0B42CE93C03B /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 57C4F6EFB30DDD14E960AC2D6B34F904 /* SnapKit-umbrella.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 98612CDED433273F86F323607C2B579D /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ FBEDAA38D7E0B3C8DEE459EAA095C48C /* Pods-JoyGemAIDemo-umbrella.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ A440384545772625048C36C84242D128 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ B543A1E1882CAEA19589891FCE2D17EA /* NSRunLoop+SRWebSocket.h in Headers */,
+ 3BB0B5D924BE769E95E64A5E6FC1675D /* NSRunLoop+SRWebSocketPrivate.h in Headers */,
+ 56851E11140A140A15088A41DC4C33BD /* NSURLRequest+SRWebSocket.h in Headers */,
+ 7174D48AADABCBE6FC53185C5442B952 /* NSURLRequest+SRWebSocketPrivate.h in Headers */,
+ 07632D281C5DED61CC7866B079BC9D2C /* SocketRocket.h in Headers */,
+ 5B67445AE2F3934BDA08D407BBA3028B /* SocketRocket-umbrella.h in Headers */,
+ C92D93F48E74B79C08A2C5B81B68FD7D /* SRConstants.h in Headers */,
+ EC8DB2CC9791B7DC686DCC78EFBB56C5 /* SRDelegateController.h in Headers */,
+ 65E5693A457A8AEE3E5758075D1E2792 /* SRError.h in Headers */,
+ F6E948E2688CC08D3843DAA74F6328E8 /* SRHash.h in Headers */,
+ DF011D18EBB28ECE459B6D96D3E460D8 /* SRHTTPConnectMessage.h in Headers */,
+ 9A3B9C740BC8FE0500132251551E5BE7 /* SRIOConsumer.h in Headers */,
+ 44EFA9A76932F81582D03076A8346A4B /* SRIOConsumerPool.h in Headers */,
+ 89CAC1E5DC5833EE630A652957D253A7 /* SRLog.h in Headers */,
+ 782981022BF319DFD85AE89A392639A2 /* SRMutex.h in Headers */,
+ 04986EEC139DC7C45DAB58056315FDC8 /* SRPinningSecurityPolicy.h in Headers */,
+ 6464C345447C71904DA3706AACA3F55D /* SRProxyConnect.h in Headers */,
+ C36214D8311B615CDA115276934926DC /* SRRandom.h in Headers */,
+ 939EE0216FC02064B2F5894E87628182 /* SRRunLoopThread.h in Headers */,
+ 2B7184BD487141C385B3CC3F3984AA55 /* SRSecurityPolicy.h in Headers */,
+ 5DFD87881941225F0A5EAE64EB247708 /* SRSIMDHelpers.h in Headers */,
+ 57A34E19799F03EB53206496FD362449 /* SRURLUtilities.h in Headers */,
+ 444E95921E2BDCE7512867EAA1A6B381 /* SRWebSocket.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ FADE750CFF2C806685AE314EE7FF71B1 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 1739C4B63D12177E58B7110F21E939EB /* SVIndefiniteAnimatedView.h in Headers */,
+ 14F6602F47FF59347CB6807CE217EDC5 /* SVProgressAnimatedView.h in Headers */,
+ 91930FDB4F9CCBBA9789806D1611AE6F /* SVProgressHUD.h in Headers */,
+ 6037BA6633BDFF4F63D6C8B7C70D6160 /* SVProgressHUD-umbrella.h in Headers */,
+ 7804E0B3C98A2FE1E98AF544E88C9C3C /* SVRadialGradientLayer.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 1948D0B63D2CF6A48E18B0B292BC6091 /* SocketRocket */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 698D46877F77FCD24D7D79E95A4A06D5 /* Build configuration list for PBXNativeTarget "SocketRocket" */;
+ buildPhases = (
+ A440384545772625048C36C84242D128 /* Headers */,
+ 5B14979992C9DB89400DDFB2EB8B8ECB /* Sources */,
+ 796567F81D938DA74DF71A2AFF3F8F3D /* Frameworks */,
+ A540247F97F33E3F24D6C4B41FFA27DB /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = SocketRocket;
+ productName = SocketRocket;
+ productReference = 85A01882ED06DFEA2E0CE78BCDB204A7 /* SocketRocket.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+ 19622742EBA51E823D6DAE3F8CDBFAD4 /* SnapKit */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 80CE967CAA1D35721519F892BAF7A19B /* Build configuration list for PBXNativeTarget "SnapKit" */;
+ buildPhases = (
+ 5B1500FE995B9224E0AF0B42CE93C03B /* Headers */,
+ F7AC6792C89443C7B212A06E810BAB97 /* Sources */,
+ 33428AC36668E3ED52DB70316F843FB8 /* Frameworks */,
+ 1DEDF411E550D85A1218E1655456A9CD /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 520872BF964A7F09A45D9E60A00FF7C7 /* PBXTargetDependency */,
+ );
+ name = SnapKit;
+ productName = SnapKit;
+ productReference = 979486118B3E90C08386079D57962701 /* SnapKit.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+ 1C8D67D8B72D6BA42CCEDB648537A340 /* SVProgressHUD */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 69444753864BFEE93D93DCEABA3746A1 /* Build configuration list for PBXNativeTarget "SVProgressHUD" */;
+ buildPhases = (
+ FADE750CFF2C806685AE314EE7FF71B1 /* Headers */,
+ 458ACEF2C06C471F7CFF2C2824CA0B34 /* Sources */,
+ 58634B2196876B07B5310C7EACCF921E /* Frameworks */,
+ 240039A2FB82D44B5CE5DB05D41F6BA9 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = SVProgressHUD;
+ productName = SVProgressHUD;
+ productReference = E97D43C46A45EE515A4DA3AF94398441 /* SVProgressHUD.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+ 8A8DB685241263AFDF5E6B20FE67B93A /* SnapKit-SnapKit_Privacy */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = F55BB91ADB9FCCFBB0980F63AA073317 /* Build configuration list for PBXNativeTarget "SnapKit-SnapKit_Privacy" */;
+ buildPhases = (
+ E3AF1CE77BB4FC6598CEC51A20D48A9B /* Sources */,
+ 4B4CD810BB6E6D719ECFED6C6CA9C997 /* Frameworks */,
+ 68ED73B0A5E4636019D5743C510C805E /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = "SnapKit-SnapKit_Privacy";
+ productName = SnapKit_Privacy;
+ productReference = B9DCB5EC0B1CDADD221717CADDF62359 /* SnapKit_Privacy.bundle */;
+ productType = "com.apple.product-type.bundle";
+ };
+ A292712D9B517D61D36A01A8ACB539E4 /* Pods-JoyGemAIDemo */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 29A6174BFC9EF989DA9D77553CEF1F9A /* Build configuration list for PBXNativeTarget "Pods-JoyGemAIDemo" */;
+ buildPhases = (
+ 98612CDED433273F86F323607C2B579D /* Headers */,
+ BCDBBFDA5E0246EB6CA7430149DDB02C /* Sources */,
+ 8CBA52A0E5D17C5026C3C675B65FA403 /* Frameworks */,
+ 88A4AF5A2D6323D7CC924EA72A6E8652 /* Resources */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 4AD4CED1A13727380BA9A18B1EDC8A09 /* PBXTargetDependency */,
+ 23C86F95D374FB58DE6233F360D853F8 /* PBXTargetDependency */,
+ AF7FA56ABD82159931F7B43641E7EC5F /* PBXTargetDependency */,
+ );
+ name = "Pods-JoyGemAIDemo";
+ productName = Pods_JoyGemAIDemo;
+ productReference = D863F9DE61CFC7AA3F031CE3260FFE4D /* Pods_JoyGemAIDemo.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ BFDFE7DC352907FC980B868725387E98 /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastSwiftUpdateCheck = 1600;
+ LastUpgradeCheck = 1600;
+ };
+ buildConfigurationList = 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */;
+ compatibilityVersion = "Xcode 16.0";
+ developmentRegion = en;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ Base,
+ en,
+ );
+ mainGroup = CF1408CF629C7361332E53B88F7BD30C;
+ productRefGroup = 5D86D48A3B789FF96DC016334C09ECA3 /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ A292712D9B517D61D36A01A8ACB539E4 /* Pods-JoyGemAIDemo */,
+ 19622742EBA51E823D6DAE3F8CDBFAD4 /* SnapKit */,
+ 8A8DB685241263AFDF5E6B20FE67B93A /* SnapKit-SnapKit_Privacy */,
+ 1948D0B63D2CF6A48E18B0B292BC6091 /* SocketRocket */,
+ 1C8D67D8B72D6BA42CCEDB648537A340 /* SVProgressHUD */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 1DEDF411E550D85A1218E1655456A9CD /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9E0045B41BFE697DB4ADE151228024D2 /* SnapKit_Privacy.bundle in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 240039A2FB82D44B5CE5DB05D41F6BA9 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 89717EC07E6324D3405867E754AE9131 /* PrivacyInfo.xcprivacy in Resources */,
+ 7B0DD32902633C7FF95B5745D8322BC3 /* SVProgressHUD.bundle in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 68ED73B0A5E4636019D5743C510C805E /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9FD199868823028AAB5681E3B7BFFB0E /* PrivacyInfo.xcprivacy in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 88A4AF5A2D6323D7CC924EA72A6E8652 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ A540247F97F33E3F24D6C4B41FFA27DB /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 458ACEF2C06C471F7CFF2C2824CA0B34 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ CEC96BA519484844D19338CC420C8808 /* SVIndefiniteAnimatedView.m in Sources */,
+ E30E824D8CE04C815FAD7F424CF7C270 /* SVProgressAnimatedView.m in Sources */,
+ F87D4D6C6668A4AA86232BA3BDB9A178 /* SVProgressHUD.m in Sources */,
+ FB75853E6A0E0682E1000CFBD293EBBC /* SVProgressHUD-dummy.m in Sources */,
+ 517CF33F75EA768ED4B7F0F440F54A7E /* SVRadialGradientLayer.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 5B14979992C9DB89400DDFB2EB8B8ECB /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 5E7E257AE5D618E46EF57A5818010F85 /* NSRunLoop+SRWebSocket.m in Sources */,
+ 6645E9FB4265C5712E38055C931E1630 /* NSURLRequest+SRWebSocket.m in Sources */,
+ A3585531EE4D8466B74A5A6F7958EC79 /* SocketRocket-dummy.m in Sources */,
+ B893C0DD5BE32FAE1D6895E1ED392B7A /* SRConstants.m in Sources */,
+ 1A117EC847E321871E40EB39F3576D11 /* SRDelegateController.m in Sources */,
+ AB12501C57FFF722131F674ACB425944 /* SRError.m in Sources */,
+ EB3BCE9B36BF814DA3069FA077168301 /* SRHash.m in Sources */,
+ 0362BB03F32EC9FB6013DEE29E8E33EF /* SRHTTPConnectMessage.m in Sources */,
+ FCFC8D5B48F3DC4BC8942320631D8C1B /* SRIOConsumer.m in Sources */,
+ 20B8C7C05E3AF3032935F30500EF5550 /* SRIOConsumerPool.m in Sources */,
+ CF6554D8A9380CAC0F51D5043769D930 /* SRLog.m in Sources */,
+ A564D0B0EE8AED950D943A75C2B3092E /* SRMutex.m in Sources */,
+ D25185C12789EA624C8BAC6A6432E77B /* SRPinningSecurityPolicy.m in Sources */,
+ D623A6CB33709C4D87766C66A756A0F7 /* SRProxyConnect.m in Sources */,
+ 9A3761D8CEFB0E2131D2EFA2DEBB3A99 /* SRRandom.m in Sources */,
+ 92571FFBEF3A7B2F4F633624013010EE /* SRRunLoopThread.m in Sources */,
+ 8D0D15CE4E92BA4433AE7EA578FE3E15 /* SRSecurityPolicy.m in Sources */,
+ 6135798CCD656C1B3A6EA5738A23190A /* SRSIMDHelpers.m in Sources */,
+ 7F30D73D46CAD9D21A25738B11A6DDDA /* SRURLUtilities.m in Sources */,
+ 4DC15DC2DF3C4BBA344C86B112C9C68B /* SRWebSocket.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ BCDBBFDA5E0246EB6CA7430149DDB02C /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ ABC03808F32631C31667667948258ACE /* Pods-JoyGemAIDemo-dummy.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ E3AF1CE77BB4FC6598CEC51A20D48A9B /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ F7AC6792C89443C7B212A06E810BAB97 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 6E39129FC8643A70C276801FEF4C280D /* Constraint.swift in Sources */,
+ 0CA7A132ABE7018DE9295456732F38BB /* ConstraintAttributes.swift in Sources */,
+ F9EBA65892D78A31C068D727D84BCB88 /* ConstraintConfig.swift in Sources */,
+ CE593943A9E7CF83822CF60304BCAD43 /* ConstraintConstantTarget.swift in Sources */,
+ 7AF516B98D45391B909D507D0244104C /* ConstraintDescription.swift in Sources */,
+ 1194E62AA3F6F506799B1A43B16942B5 /* ConstraintDirectionalInsets.swift in Sources */,
+ E37671A03B4C17A1CF3766A6125833BB /* ConstraintDirectionalInsetTarget.swift in Sources */,
+ 868A9F524A7985BDA1EA124D9BF4CA63 /* ConstraintDSL.swift in Sources */,
+ AF760C78F1C7E11BF7CB9E9B29903530 /* ConstraintInsets.swift in Sources */,
+ 2B2EB369550CE92CEEFCBFD3D32B8A3F /* ConstraintInsetTarget.swift in Sources */,
+ 5922A6A0AE7152CF436356B3556F1835 /* ConstraintItem.swift in Sources */,
+ 59F34874DA4ABB2F5C4E09EA6865936B /* ConstraintLayoutGuide.swift in Sources */,
+ E3D779DEE753C0B0D33BA8E73A980265 /* ConstraintLayoutGuide+Extensions.swift in Sources */,
+ 3D3B646B4988314275B40E97BEB16C7F /* ConstraintLayoutGuideDSL.swift in Sources */,
+ B0875E3AB8718E7DFE5C53497C02A15E /* ConstraintLayoutSupport.swift in Sources */,
+ 064D909CD827405E8DCC309DB1B7775A /* ConstraintLayoutSupportDSL.swift in Sources */,
+ 4F4DEB687C0E4834A5B291DEE0651D6A /* ConstraintMaker.swift in Sources */,
+ C14F10B663FE2898EACAB90C202B3F50 /* ConstraintMakerEditable.swift in Sources */,
+ D4218DA55B2BA45937589200CC0DF1FB /* ConstraintMakerExtendable.swift in Sources */,
+ B903049E7C1BED7918DAB208754107C7 /* ConstraintMakerFinalizable.swift in Sources */,
+ AABEF13464BA7F4621BD94736C1D057C /* ConstraintMakerPrioritizable.swift in Sources */,
+ BDA5C7CC91E86448237CF40954FAC5AF /* ConstraintMakerRelatable.swift in Sources */,
+ 8BABA32F7B94A25D8E9208C0A8D90B2E /* ConstraintMakerRelatable+Extensions.swift in Sources */,
+ 883EDEE1C699497CF2A77C3B8A32A790 /* ConstraintMultiplierTarget.swift in Sources */,
+ 3577F172FA68CBAE47CFEE6FE25C5404 /* ConstraintOffsetTarget.swift in Sources */,
+ 09E1F569A93FAD4B9149E30B9301F44A /* ConstraintPriority.swift in Sources */,
+ DBA4803F4765E1650B8C6841157F5D73 /* ConstraintPriorityTarget.swift in Sources */,
+ C07CB3E9A4D1BF00F841E4285629A2B2 /* ConstraintRelatableTarget.swift in Sources */,
+ ECC5C2ADC2682F9171FEA22AF10DCE53 /* ConstraintRelation.swift in Sources */,
+ 86CAB01D950C8BC35EDE0BDC01A2500B /* ConstraintView.swift in Sources */,
+ 0DE5DB9C6227B3416778D8417DD95EA9 /* ConstraintView+Extensions.swift in Sources */,
+ 7D42390CDB4FA147504B03DA2A174A0C /* ConstraintViewDSL.swift in Sources */,
+ AE224EDB6D044C0FE86B086E950FC2F9 /* Debugging.swift in Sources */,
+ BF1AE4D97E813B95C43EA4A298B973D1 /* LayoutConstraint.swift in Sources */,
+ C6F45595676957ADBEC18EB3F23EAEC4 /* LayoutConstraintItem.swift in Sources */,
+ BA2FB695DEB0D179253EEB8DFCE3578B /* SnapKit-dummy.m in Sources */,
+ C6A4302ACE006C4E2CDD481287E2916B /* Typealiases.swift in Sources */,
+ F6F33E8B268F3D41075374D95B8088DC /* UILayoutSupport+Extensions.swift in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 23C86F95D374FB58DE6233F360D853F8 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = SnapKit;
+ target = 19622742EBA51E823D6DAE3F8CDBFAD4 /* SnapKit */;
+ targetProxy = FD48D631BAD9713237222F94224B4230 /* PBXContainerItemProxy */;
+ };
+ 4AD4CED1A13727380BA9A18B1EDC8A09 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = SVProgressHUD;
+ target = 1C8D67D8B72D6BA42CCEDB648537A340 /* SVProgressHUD */;
+ targetProxy = A2037CAFBFB3B718C2AE2F4FB05B8705 /* PBXContainerItemProxy */;
+ };
+ 520872BF964A7F09A45D9E60A00FF7C7 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = "SnapKit-SnapKit_Privacy";
+ target = 8A8DB685241263AFDF5E6B20FE67B93A /* SnapKit-SnapKit_Privacy */;
+ targetProxy = C860B402EF6D807222EE55F2EA175448 /* PBXContainerItemProxy */;
+ };
+ AF7FA56ABD82159931F7B43641E7EC5F /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ name = SocketRocket;
+ target = 1948D0B63D2CF6A48E18B0B292BC6091 /* SocketRocket */;
+ targetProxy = 835DF671A580FED0D976A9BE52562532 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 243E47468B1AA86AEB11F03BA7A94E3A /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7BA73F09977C922C7B7FA7C0B234E9E3 /* SnapKit.release.xcconfig */;
+ buildSettings = {
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SnapKit/SnapKit-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SnapKit/SnapKit-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SnapKit/SnapKit.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SnapKit;
+ PRODUCT_NAME = SnapKit;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+ 2E97CC1C8355042CF6D2B315FDABEA75 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7BA73F09977C922C7B7FA7C0B234E9E3 /* SnapKit.release.xcconfig */;
+ buildSettings = {
+ CODE_SIGNING_ALLOWED = NO;
+ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/SnapKit";
+ IBSC_MODULE = SnapKit;
+ INFOPLIST_FILE = "Target Support Files/SnapKit/ResourceBundle-SnapKit_Privacy-SnapKit-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ PRODUCT_NAME = SnapKit_Privacy;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = bundle;
+ };
+ name = Release;
+ };
+ 3E89D47477058425C765DFFBF8BB0C33 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = D137CAEEE2D408A7495FA50188CB4D52 /* SnapKit.debug.xcconfig */;
+ buildSettings = {
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SnapKit/SnapKit-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SnapKit/SnapKit-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SnapKit/SnapKit.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SnapKit;
+ PRODUCT_NAME = SnapKit;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+ 4146417E0A5EEF9CD061673E613C7D4E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu17;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "POD_CONFIGURATION_RELEASE=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ MTL_FAST_MATH = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ STRIP_INSTALLED_PRODUCT = NO;
+ SWIFT_COMPILATION_MODE = wholemodule;
+ SWIFT_VERSION = 5.0;
+ SYMROOT = "${SRCROOT}/../build";
+ };
+ name = Release;
+ };
+ 48AF7EB2069114CB866140B406C66503 /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 93096358FB9D70A7A7498BAA812CCA52 /* Pods-JoyGemAIDemo.release.xcconfig */;
+ buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MACH_O_TYPE = staticlib;
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ OTHER_LDFLAGS = "";
+ OTHER_LIBTOOLFLAGS = "";
+ PODS_ROOT = "$(SRCROOT)";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
+ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = NO;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+ 5BD29E55997C2B25631D864E8E7AF45B /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = B2B52318F57059FC39EB5115B64E4FCF /* SVProgressHUD.release.xcconfig */;
+ buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SVProgressHUD/SVProgressHUD-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SVProgressHUD/SVProgressHUD-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SVProgressHUD/SVProgressHUD.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SVProgressHUD;
+ PRODUCT_NAME = SVProgressHUD;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+ 5E48A05D0E3DCED9E5C0F1507DC1517E /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 8F23DB1C587B4583CD55800A55481EB6 /* SocketRocket.release.xcconfig */;
+ buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SocketRocket/SocketRocket-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SocketRocket/SocketRocket-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SocketRocket/SocketRocket.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SocketRocket;
+ PRODUCT_NAME = SocketRocket;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Release;
+ };
+ 84B6A261A9603785947F8535D83CD6DC /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9A9313FF4398CEE1734CB6357724A7F1 /* Pods-JoyGemAIDemo.debug.xcconfig */;
+ buildSettings = {
+ ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = NO;
+ BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GENERATE_INFOPLIST_FILE = YES;
+ INFOPLIST_FILE = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MACH_O_TYPE = staticlib;
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ OTHER_LDFLAGS = "";
+ OTHER_LIBTOOLFLAGS = "";
+ PODS_ROOT = "$(SRCROOT)";
+ PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}";
+ PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = NO;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+ 8EDDE50761E2BD694755FA38A2B7F264 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = D137CAEEE2D408A7495FA50188CB4D52 /* SnapKit.debug.xcconfig */;
+ buildSettings = {
+ CODE_SIGNING_ALLOWED = NO;
+ CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/SnapKit";
+ IBSC_MODULE = SnapKit;
+ INFOPLIST_FILE = "Target Support Files/SnapKit/ResourceBundle-SnapKit_Privacy-SnapKit-Info.plist";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ PRODUCT_NAME = SnapKit_Privacy;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ WRAPPER_EXTENSION = bundle;
+ };
+ name = Debug;
+ };
+ 8FA7A7481543B3DBB7E250B6A3372323 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
+ CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++20";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_ENABLE_OBJC_WEAK = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ ENABLE_USER_SCRIPT_SANDBOXING = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu17;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "POD_CONFIGURATION_DEBUG=1",
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 13.0;
+ LOCALIZATION_PREFERS_STRING_CATALOGS = YES;
+ MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
+ MTL_FAST_MATH = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ STRIP_INSTALLED_PRODUCT = NO;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_VERSION = 5.0;
+ SYMROOT = "${SRCROOT}/../build";
+ };
+ name = Debug;
+ };
+ A7D2C32586573154B17B858DF64FF000 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 925714E4666F0554718E983964951A8B /* SVProgressHUD.debug.xcconfig */;
+ buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SVProgressHUD/SVProgressHUD-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SVProgressHUD/SVProgressHUD-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SVProgressHUD/SVProgressHUD.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SVProgressHUD;
+ PRODUCT_NAME = SVProgressHUD;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+ E257492C03FE874E4F85F9A1CEF19BFD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = CC293BBB9A5E4968EE4ED5F611BF8162 /* SocketRocket.debug.xcconfig */;
+ buildSettings = {
+ CLANG_ENABLE_OBJC_WEAK = NO;
+ "CODE_SIGN_IDENTITY[sdk=appletvos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
+ "CODE_SIGN_IDENTITY[sdk=watchos*]" = "";
+ CURRENT_PROJECT_VERSION = 1;
+ DEFINES_MODULE = YES;
+ DYLIB_COMPATIBILITY_VERSION = 1;
+ DYLIB_CURRENT_VERSION = 1;
+ DYLIB_INSTALL_NAME_BASE = "@rpath";
+ ENABLE_MODULE_VERIFIER = NO;
+ ENABLE_USER_SCRIPT_SANDBOXING = NO;
+ GCC_PREFIX_HEADER = "Target Support Files/SocketRocket/SocketRocket-prefix.pch";
+ GENERATE_INFOPLIST_FILE = NO;
+ INFOPLIST_FILE = "Target Support Files/SocketRocket/SocketRocket-Info.plist";
+ INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
+ IPHONEOS_DEPLOYMENT_TARGET = 11.0;
+ LD_RUNPATH_SEARCH_PATHS = (
+ "$(inherited)",
+ "@executable_path/Frameworks",
+ "@loader_path/Frameworks",
+ );
+ MARKETING_VERSION = 1.0;
+ MODULEMAP_FILE = "Target Support Files/SocketRocket/SocketRocket.modulemap";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGES = "objective-c objective-c++";
+ MODULE_VERIFIER_SUPPORTED_LANGUAGE_STANDARDS = "gnu17 gnu++20";
+ PRODUCT_MODULE_NAME = SocketRocket;
+ PRODUCT_NAME = SocketRocket;
+ SDKROOT = iphoneos;
+ SKIP_INSTALL = YES;
+ SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) ";
+ SWIFT_EMIT_LOC_STRINGS = YES;
+ SWIFT_INSTALL_OBJC_HEADER = YES;
+ SWIFT_VERSION = 5.0;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VERSIONING_SYSTEM = "apple-generic";
+ VERSION_INFO_PREFIX = "";
+ };
+ name = Debug;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 29A6174BFC9EF989DA9D77553CEF1F9A /* Build configuration list for PBXNativeTarget "Pods-JoyGemAIDemo" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 84B6A261A9603785947F8535D83CD6DC /* Debug */,
+ 48AF7EB2069114CB866140B406C66503 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4821239608C13582E20E6DA73FD5F1F9 /* Build configuration list for PBXProject "Pods" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 8FA7A7481543B3DBB7E250B6A3372323 /* Debug */,
+ 4146417E0A5EEF9CD061673E613C7D4E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 69444753864BFEE93D93DCEABA3746A1 /* Build configuration list for PBXNativeTarget "SVProgressHUD" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ A7D2C32586573154B17B858DF64FF000 /* Debug */,
+ 5BD29E55997C2B25631D864E8E7AF45B /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 698D46877F77FCD24D7D79E95A4A06D5 /* Build configuration list for PBXNativeTarget "SocketRocket" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ E257492C03FE874E4F85F9A1CEF19BFD /* Debug */,
+ 5E48A05D0E3DCED9E5C0F1507DC1517E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 80CE967CAA1D35721519F892BAF7A19B /* Build configuration list for PBXNativeTarget "SnapKit" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 3E89D47477058425C765DFFBF8BB0C33 /* Debug */,
+ 243E47468B1AA86AEB11F03BA7A94E3A /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ F55BB91ADB9FCCFBB0980F63AA073317 /* Build configuration list for PBXNativeTarget "SnapKit-SnapKit_Privacy" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 8EDDE50761E2BD694755FA38A2B7F264 /* Debug */,
+ 2E97CC1C8355042CF6D2B315FDABEA75 /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = BFDFE7DC352907FC980B868725387E98 /* Project object */;
+}
--- /dev/null
+MIT License
+
+Copyright (c) 2011-2023 Sam Vermette, Tobias Totzek and contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+# SVProgressHUD
+
+
+
+
+[](https://swift.org/package-manager/)
+[](https://cocoapods.org)
+[](https://github.com/Carthage/Carthage)
+
+`SVProgressHUD` is a clean and easy-to-use HUD meant to display the progress of an ongoing task on iOS and tvOS.
+
+
+
+## Installation
+
+### Swift Package Manager
+
+[Swift Package Manager](https://swift.org/package-manager/) (SwiftPM) is a tool for managing the distribution of Swift code. It simplifies the process of managing Swift package dependencies.
+
+To integrate `SVProgressHUD` into your project using SwiftPM:
+
+1. In Xcode, select **File > Add Package Dependency**.
+2. Enter the following package repository URL: https://github.com/SVProgressHUD/SVProgressHUD.git
+3. Choose the appropriate version (e.g. a specific version, branch, or commit).
+4. Add `SVProgressHUD` to your target dependencies.
+
+`SVProgressHUD` requires at least Swift tools version 5.3.
+
+### From CocoaPods
+
+[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like `SVProgressHUD` in your projects. First, add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
+
+```ruby
+pod 'SVProgressHUD'
+```
+
+If you want to use the latest features of `SVProgressHUD` use normal external source dependencies.
+
+```ruby
+pod 'SVProgressHUD', :git => 'https://github.com/SVProgressHUD/SVProgressHUD.git'
+```
+
+This pulls from the `master` branch directly.
+
+Second, install `SVProgressHUD` into your project:
+
+```ruby
+pod install
+```
+
+### Carthage
+
+[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. To integrate `SVProgressHUD` into your Xcode project using Carthage, specify it in your `Cartfile`:
+
+```ogdl
+github "SVProgressHUD/SVProgressHUD"
+```
+
+Run `carthage bootstrap` to build the framework in your repository's Carthage directory. You can then include it in your target's `carthage copy-frameworks` build phase. For more information on this, please see [Carthage's documentation](https://github.com/carthage/carthage#if-youre-building-for-ios-tvos-or-watchos).
+
+### Manually
+
+* Drag the `SVProgressHUD/SVProgressHUD` folder into your project.
+* Take care that `SVProgressHUD.bundle` is added to `Targets->Build Phases->Copy Bundle Resources`.
+* Add the **QuartzCore** framework to your project.
+
+## Swift
+
+Even though `SVProgressHUD` is written in Objective-C, it can be used in Swift with no hassle.
+
+If you use [CocoaPods](http://cocoapods.org) add the following line to your [Podfile](http://guides.cocoapods.org/using/using-cocoapods.html):
+
+```ruby
+use_frameworks!
+```
+
+If you added `SVProgressHUD` manually, just add a [bridging header](https://developer.apple.com/library/content/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html) file to your project with the `SVProgressHUD` header included.
+
+## Usage
+
+(see sample Xcode project in `/Demo`)
+
+`SVProgressHUD` is created as a singleton (i.e. it doesn't need to be explicitly allocated and instantiated; you directly call `[SVProgressHUD method]` / `SVProgressHUD.method()`).
+
+**Use `SVProgressHUD` wisely! Only use it if you absolutely need to perform a task before taking the user forward. Bad use case examples: pull to refresh, infinite scrolling, sending message.**
+
+Using `SVProgressHUD` in your app will usually look as simple as this.
+
+**Objective-C:**
+
+```objective-c
+[SVProgressHUD show];
+dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+ // time-consuming task
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [SVProgressHUD dismiss];
+ });
+});
+```
+
+**Swift:**
+
+```swift
+SVProgressHUD.show()
+DispatchQueue.global(qos: .default).async {
+ // time-consuming task
+ DispatchQueue.main.async {
+ SVProgressHUD.dismiss()
+ }
+}
+```
+
+### Showing the HUD
+
+You can show the status of indeterminate tasks using one of the following:
+
+```objective-c
++ (void)show;
++ (void)showWithStatus:(NSString*)string;
+```
+
+If you'd like the HUD to reflect the progress of a task, use one of these:
+
+```objective-c
++ (void)showProgress:(CGFloat)progress;
++ (void)showProgress:(CGFloat)progress status:(NSString*)status;
+```
+
+### Dismissing the HUD
+
+The HUD can be dismissed using:
+
+```objective-c
++ (void)dismiss;
++ (void)dismissWithDelay:(NSTimeInterval)delay;
+```
+
+If you'd like to stack HUDs, you can balance out every show call using:
+
+```
++ (void)popActivity;
+```
+
+The HUD will get dismissed once the `popActivity` calls will match the number of show calls.
+
+Or show an image with status before getting dismissed a little bit later. The display time depends on `minimumDismissTimeInterval` and the length of the given string.
+
+```objective-c
++ (void)showInfoWithStatus:(NSString*)string;
++ (void)showSuccessWithStatus:(NSString*)string;
++ (void)showErrorWithStatus:(NSString*)string;
++ (void)showImage:(UIImage*)image status:(NSString*)string;
+```
+
+## Customization
+
+`SVProgressHUD` is designed with flexibility in mind, providing a myriad of customization options to fit the look and feel of your application seamlessly.
+
+* Appearance: Make use of the `UI_APPEARANCE_SELECTOR` to adjust styles, colors, fonts, size, and images app-wide.
+* Behavior: Control visibility durations, display delays, and animation speeds.
+* Feedback: Enhance the user experience with options for haptic feedback and motion effects.
+
+For a comprehensive list of properties and detailed explanations, refer to the `SVProgressHUD.h` file in the API documentation.
+
+### Hint
+
+As standard `SVProgressHUD` offers three preconfigured styles:
+
+* `SVProgressHUDStyleAutomatic`: Automatically switch between the light and dark style
+* `SVProgressHUDStyleLight`: White background with black spinner and text
+* `SVProgressHUDStyleDark`: Black background with white spinner and text
+
+If you want to use custom colors use `setForegroundColor:` and/or `setBackgroundColor:`. These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
+
+## Haptic Feedback
+
+Available on iPhone 7 and newer, `SVProgressHUD` can automatically trigger haptic feedback depending on which HUD is being displayed. The feedback maps as follows:
+
+* `showSuccessWithStatus:` <-> `UINotificationFeedbackTypeSuccess`
+* `showInfoWithStatus:` <-> `UINotificationFeedbackTypeWarning`
+* `showErrorWithStatus:` <-> `UINotificationFeedbackTypeError`
+
+To enable this functionality, use `setHapticsEnabled:`.
+
+## Notifications
+
+`SVProgressHUD` posts four notifications via `NSNotificationCenter` in response to being shown/dismissed:
+
+* `SVProgressHUDWillAppearNotification` when the show animation starts
+* `SVProgressHUDDidAppearNotification` when the show animation completes
+* `SVProgressHUDWillDisappearNotification` when the dismiss animation starts
+* `SVProgressHUDDidDisappearNotification` when the dismiss animation completes
+
+Each notification passes a `userInfo` dictionary holding the HUD's status string (if any), retrievable via `SVProgressHUDStatusUserInfoKey`.
+
+`SVProgressHUD` also posts `SVProgressHUDDidReceiveTouchEventNotification` when users touch on the overall screen or `SVProgressHUDDidTouchDownInsideNotification` when a user touches on the HUD directly. For these notifications `userInfo` is not passed but the object parameter contains the `UIEvent` that related to the touch.
+
+## App Extensions
+
+When using `SVProgressHUD` in an App Extension, `#define SV_APP_EXTENSIONS` to avoid using unavailable APIs. This will be done automatically when using the `AppExtension` CocoaPods subspec. Additionally, call `setViewForExtension:` from your extensions view controller with `self.view`.
+
+## Contributing to this project
+
+If you have feature requests or bug reports, feel free to help out by sending pull requests or by [creating new issues](https://github.com/SVProgressHUD/SVProgressHUD/issues/new). Please take a moment to
+review the guidelines written by [Nicolas Gallagher](https://github.com/necolas):
+
+* [Bug reports](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#bugs)
+* [Feature requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#features)
+* [Pull requests](https://github.com/necolas/issue-guidelines/blob/master/CONTRIBUTING.md#pull-requests)
+
+## License
+
+`SVProgressHUD` is distributed under the terms and conditions of the [MIT license](https://github.com/SVProgressHUD/SVProgressHUD/blob/master/LICENSE). The success, error and info icons used on iOS 12 are made by [Freepik](http://www.freepik.com) from [Flaticon](https://www.flaticon.com) and are licensed under [Creative Commons BY 3.0](https://creativecommons.org/licenses/by/3.0/).
+
+## Privacy
+
+`SVProgressHUD` does not collect any data. A [privacy manifest file](https://developer.apple.com/documentation/bundleresources/privacy_manifest_files) is [provided](SVProgressHUD/PrivacyInfo.xcprivacy).
+
+## Credits
+
+`SVProgressHUD` is brought to you by Sam Vermette, [Tobias Totzek](https://totzek.me) and [contributors to the project](https://github.com/SVProgressHUD/SVProgressHUD/contributors). If you're using `SVProgressHUD` in your project, attribution would be very appreciated.
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSPrivacyTracking</key>
+ <false/>
+ <key>NSPrivacyCollectedDataTypes</key>
+ <array/>
+ <key>NSPrivacyTrackingDomains</key>
+ <array/>
+ <key>NSPrivacyAccessedAPITypes</key>
+ <array/>
+</dict>
+</plist>
--- /dev/null
+//
+// SVIndefiniteAnimatedView.h
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2014-2023 Guillaume Campagna and contributors. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SVIndefiniteAnimatedView : UIView
+
+@property (nonatomic, assign) CGFloat strokeThickness;
+@property (nonatomic, assign) CGFloat radius;
+@property (nonatomic, strong) UIColor *strokeColor;
+
+@end
+
--- /dev/null
+//
+// SVIndefiniteAnimatedView.m
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2014-2023 Guillaume Campagna and contributors. All rights reserved.
+//
+
+#import "SVIndefiniteAnimatedView.h"
+#import "SVProgressHUD.h"
+
+@interface SVIndefiniteAnimatedView ()
+
+@property (nonatomic, strong) CAShapeLayer *indefiniteAnimatedLayer;
+
+@end
+
+@implementation SVIndefiniteAnimatedView
+
+- (void)willMoveToSuperview:(UIView*)newSuperview {
+ if (newSuperview) {
+ [self layoutAnimatedLayer];
+ } else {
+ [_indefiniteAnimatedLayer removeFromSuperlayer];
+ _indefiniteAnimatedLayer = nil;
+ }
+}
+
+- (void)layoutSubviews {
+ [super layoutSubviews];
+
+ [self layoutAnimatedLayer];
+}
+
+- (void)layoutAnimatedLayer {
+ CALayer *layer = self.indefiniteAnimatedLayer;
+
+ if (!layer.superlayer) {
+ [self.layer addSublayer:layer];
+ }
+
+ CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
+ CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
+ layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
+}
+
+- (CAShapeLayer*)indefiniteAnimatedLayer {
+ if(!_indefiniteAnimatedLayer) {
+ CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
+ UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat) (M_PI*3/2) endAngle:(CGFloat) (M_PI/2+M_PI*5) clockwise:YES];
+
+ _indefiniteAnimatedLayer = [CAShapeLayer layer];
+ _indefiniteAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
+ _indefiniteAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
+ _indefiniteAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
+ _indefiniteAnimatedLayer.strokeColor = self.strokeColor.CGColor;
+ _indefiniteAnimatedLayer.lineWidth = self.strokeThickness;
+ _indefiniteAnimatedLayer.lineCap = kCALineCapRound;
+ _indefiniteAnimatedLayer.lineJoin = kCALineJoinBevel;
+ _indefiniteAnimatedLayer.path = smoothedPath.CGPath;
+
+ CALayer *maskLayer = [CALayer layer];
+
+ NSBundle *imageBundle = [SVProgressHUD imageBundle];
+
+ maskLayer.contents = (__bridge id)[[UIImage imageNamed:@"angle-mask.png" inBundle:imageBundle compatibleWithTraitCollection:nil] CGImage];
+ maskLayer.frame = _indefiniteAnimatedLayer.bounds;
+ _indefiniteAnimatedLayer.mask = maskLayer;
+
+ NSTimeInterval animationDuration = 1;
+ CAMediaTimingFunction *linearCurve = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
+
+ CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"];
+ animation.fromValue = (id) 0;
+ animation.toValue = @(M_PI*2);
+ animation.duration = animationDuration;
+ animation.timingFunction = linearCurve;
+ animation.removedOnCompletion = NO;
+ animation.repeatCount = INFINITY;
+ animation.fillMode = kCAFillModeForwards;
+ animation.autoreverses = NO;
+ [_indefiniteAnimatedLayer.mask addAnimation:animation forKey:@"rotate"];
+
+ CAAnimationGroup *animationGroup = [CAAnimationGroup animation];
+ animationGroup.duration = animationDuration;
+ animationGroup.repeatCount = INFINITY;
+ animationGroup.removedOnCompletion = NO;
+ animationGroup.timingFunction = linearCurve;
+
+ CABasicAnimation *strokeStartAnimation = [CABasicAnimation animationWithKeyPath:@"strokeStart"];
+ strokeStartAnimation.fromValue = @0.015;
+ strokeStartAnimation.toValue = @0.515;
+
+ CABasicAnimation *strokeEndAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];
+ strokeEndAnimation.fromValue = @0.485;
+ strokeEndAnimation.toValue = @0.985;
+
+ animationGroup.animations = @[strokeStartAnimation, strokeEndAnimation];
+ [_indefiniteAnimatedLayer addAnimation:animationGroup forKey:@"progress"];
+
+ }
+ return _indefiniteAnimatedLayer;
+}
+
+- (void)setFrame:(CGRect)frame {
+ if(!CGRectEqualToRect(frame, super.frame)) {
+ [super setFrame:frame];
+
+ if(self.superview) {
+ [self layoutAnimatedLayer];
+ }
+ }
+
+}
+
+- (void)setRadius:(CGFloat)radius {
+ if(radius != _radius) {
+ _radius = radius;
+
+ [_indefiniteAnimatedLayer removeFromSuperlayer];
+ _indefiniteAnimatedLayer = nil;
+
+ if(self.superview) {
+ [self layoutAnimatedLayer];
+ }
+ }
+}
+
+- (void)setStrokeColor:(UIColor*)strokeColor {
+ _strokeColor = strokeColor;
+ _indefiniteAnimatedLayer.strokeColor = strokeColor.CGColor;
+}
+
+- (void)setStrokeThickness:(CGFloat)strokeThickness {
+ _strokeThickness = strokeThickness;
+ _indefiniteAnimatedLayer.lineWidth = _strokeThickness;
+}
+
+- (CGSize)sizeThatFits:(CGSize)size {
+ return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
+}
+
+@end
--- /dev/null
+//
+// SVProgressAnimatedView.h
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2017-2023 Tobias Totzek and contributors. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+
+@interface SVProgressAnimatedView : UIView
+
+@property (nonatomic, assign) CGFloat radius;
+@property (nonatomic, assign) CGFloat strokeThickness;
+@property (nonatomic, strong) UIColor *strokeColor;
+@property (nonatomic, assign) CGFloat strokeEnd;
+
+@end
--- /dev/null
+//
+// SVProgressAnimatedView.m
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2017-2023 Tobias Totzek and contributors. All rights reserved.
+//
+
+#import "SVProgressAnimatedView.h"
+
+@interface SVProgressAnimatedView ()
+
+@property (nonatomic, strong) CAShapeLayer *ringAnimatedLayer;
+
+@end
+
+@implementation SVProgressAnimatedView
+
+- (void)willMoveToSuperview:(UIView*)newSuperview {
+ if (newSuperview) {
+ [self layoutAnimatedLayer];
+ } else {
+ [_ringAnimatedLayer removeFromSuperlayer];
+ _ringAnimatedLayer = nil;
+ }
+}
+
+- (void)layoutAnimatedLayer {
+ CALayer *layer = self.ringAnimatedLayer;
+ [self.layer addSublayer:layer];
+
+ CGFloat widthDiff = CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds);
+ CGFloat heightDiff = CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds);
+ layer.position = CGPointMake(CGRectGetWidth(self.bounds) - CGRectGetWidth(layer.bounds) / 2 - widthDiff / 2, CGRectGetHeight(self.bounds) - CGRectGetHeight(layer.bounds) / 2 - heightDiff / 2);
+}
+
+- (CAShapeLayer*)ringAnimatedLayer {
+ if(!_ringAnimatedLayer) {
+ CGPoint arcCenter = CGPointMake(self.radius+self.strokeThickness/2+5, self.radius+self.strokeThickness/2+5);
+ UIBezierPath* smoothedPath = [UIBezierPath bezierPathWithArcCenter:arcCenter radius:self.radius startAngle:(CGFloat)-M_PI_2 endAngle:(CGFloat) (M_PI + M_PI_2) clockwise:YES];
+
+ _ringAnimatedLayer = [CAShapeLayer layer];
+ _ringAnimatedLayer.contentsScale = [[UIScreen mainScreen] scale];
+ _ringAnimatedLayer.frame = CGRectMake(0.0f, 0.0f, arcCenter.x*2, arcCenter.y*2);
+ _ringAnimatedLayer.fillColor = [UIColor clearColor].CGColor;
+ _ringAnimatedLayer.strokeColor = self.strokeColor.CGColor;
+ _ringAnimatedLayer.lineWidth = self.strokeThickness;
+ _ringAnimatedLayer.lineCap = kCALineCapRound;
+ _ringAnimatedLayer.lineJoin = kCALineJoinBevel;
+ _ringAnimatedLayer.path = smoothedPath.CGPath;
+ }
+ return _ringAnimatedLayer;
+}
+
+- (void)setFrame:(CGRect)frame {
+ if(!CGRectEqualToRect(frame, super.frame)) {
+ [super setFrame:frame];
+
+ if(self.superview) {
+ [self layoutAnimatedLayer];
+ }
+ }
+}
+
+- (void)setRadius:(CGFloat)radius {
+ if(radius != _radius) {
+ _radius = radius;
+
+ [_ringAnimatedLayer removeFromSuperlayer];
+ _ringAnimatedLayer = nil;
+
+ if(self.superview) {
+ [self layoutAnimatedLayer];
+ }
+ }
+}
+
+- (void)setStrokeColor:(UIColor*)strokeColor {
+ _strokeColor = strokeColor;
+ _ringAnimatedLayer.strokeColor = strokeColor.CGColor;
+}
+
+- (void)setStrokeThickness:(CGFloat)strokeThickness {
+ _strokeThickness = strokeThickness;
+ _ringAnimatedLayer.lineWidth = _strokeThickness;
+}
+
+- (void)setStrokeEnd:(CGFloat)strokeEnd {
+ _strokeEnd = strokeEnd;
+ _ringAnimatedLayer.strokeEnd = _strokeEnd;
+}
+
+- (CGSize)sizeThatFits:(CGSize)size {
+ return CGSizeMake((self.radius+self.strokeThickness/2+5)*2, (self.radius+self.strokeThickness/2+5)*2);
+}
+
+@end
--- /dev/null
+//
+// SVProgressHUD.h
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2011-2023 Sam Vermette and contributors. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import <AvailabilityMacros.h>
+
+extern NSString * _Nonnull const SVProgressHUDDidReceiveTouchEventNotification;
+extern NSString * _Nonnull const SVProgressHUDDidTouchDownInsideNotification;
+extern NSString * _Nonnull const SVProgressHUDWillDisappearNotification;
+extern NSString * _Nonnull const SVProgressHUDDidDisappearNotification;
+extern NSString * _Nonnull const SVProgressHUDWillAppearNotification;
+extern NSString * _Nonnull const SVProgressHUDDidAppearNotification;
+
+extern NSString * _Nonnull const SVProgressHUDStatusUserInfoKey;
+
+/// Represents the appearance style of the HUD.
+typedef NS_ENUM(NSInteger, SVProgressHUDStyle) {
+ /// White HUD with black text. HUD background will be blurred.
+ SVProgressHUDStyleLight NS_SWIFT_NAME(light),
+
+ /// Black HUD with white text. HUD background will be blurred.
+ SVProgressHUDStyleDark NS_SWIFT_NAME(dark),
+
+ /// Uses the fore- and background color properties.
+ SVProgressHUDStyleCustom NS_SWIFT_NAME(custom),
+
+ /// Automatically switch between light or dark mode appearance.
+ SVProgressHUDStyleAutomatic NS_SWIFT_NAME(automatic)
+};
+
+/// Represents the type of mask to be applied when the HUD is displayed.
+typedef NS_ENUM(NSUInteger, SVProgressHUDMaskType) {
+ /// Allow user interactions while HUD is displayed.
+ SVProgressHUDMaskTypeNone NS_SWIFT_NAME(none) = 1,
+
+ /// Don't allow user interactions with background objects.
+ SVProgressHUDMaskTypeClear NS_SWIFT_NAME(clear),
+
+ /// Don't allow user interactions and dim the UI behind the HUD (as in iOS 7+).
+ SVProgressHUDMaskTypeBlack NS_SWIFT_NAME(black),
+
+ /// Don't allow user interactions and dim the UI with an UIAlertView-like background gradient (as in iOS 6).
+ SVProgressHUDMaskTypeGradient NS_SWIFT_NAME(gradient),
+
+ /// Don't allow user interactions and dim the UI behind the HUD with a custom color.
+ SVProgressHUDMaskTypeCustom NS_SWIFT_NAME(custom)
+};
+
+/// Represents the animation type of the HUD when it's shown or hidden.
+typedef NS_ENUM(NSUInteger, SVProgressHUDAnimationType) {
+ /// Custom flat animation (indefinite animated ring).
+ SVProgressHUDAnimationTypeFlat NS_SWIFT_NAME(flat),
+
+ /// iOS native UIActivityIndicatorView.
+ SVProgressHUDAnimationTypeNative NS_SWIFT_NAME(native)
+};
+
+typedef void (^SVProgressHUDShowCompletion)(void);
+typedef void (^SVProgressHUDDismissCompletion)(void);
+
+@interface SVProgressHUD : UIView
+
+#pragma mark - Customization
+
+/// Represents the default style for the HUD.
+/// @discussion Default: SVProgressHUDStyleAutomatic.
+@property (assign, nonatomic) SVProgressHUDStyle defaultStyle UI_APPEARANCE_SELECTOR;
+
+/// Represents the type of mask applied when the HUD is displayed.
+/// @discussion Default: SVProgressHUDMaskTypeNone.
+@property (assign, nonatomic) SVProgressHUDMaskType defaultMaskType UI_APPEARANCE_SELECTOR;
+
+/// Defines the animation type used when the HUD is displayed.
+/// @discussion Default: SVProgressHUDAnimationTypeFlat.
+@property (assign, nonatomic) SVProgressHUDAnimationType defaultAnimationType UI_APPEARANCE_SELECTOR;
+
+/// The container view used for displaying the HUD. If nil, the default window level is used.
+@property (strong, nonatomic, nullable) UIView *containerView;
+
+/// The minimum size for the HUD. Useful for maintaining a consistent size when the message might cause resizing.
+/// @discussion Default: CGSizeZero.
+@property (assign, nonatomic) CGSize minimumSize UI_APPEARANCE_SELECTOR;
+
+/// Thickness of the ring shown in the HUD.
+/// @discussion Default: 2 pt.
+@property (assign, nonatomic) CGFloat ringThickness UI_APPEARANCE_SELECTOR;
+
+/// Radius of the ring shown in the HUD when there's associated text.
+/// @discussion Default: 18 pt.
+@property (assign, nonatomic) CGFloat ringRadius UI_APPEARANCE_SELECTOR;
+
+/// Radius of the ring shown in the HUD when there's no associated text.
+/// @discussion Default: 24 pt.
+@property (assign, nonatomic) CGFloat ringNoTextRadius UI_APPEARANCE_SELECTOR;
+
+/// Corner radius of the HUD view.
+/// @discussion Default: 14 pt.
+@property (assign, nonatomic) CGFloat cornerRadius UI_APPEARANCE_SELECTOR;
+
+/// Font used for text within the HUD.
+/// @discussion Default: [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline].
+@property (strong, nonatomic, nonnull) UIFont *font UI_APPEARANCE_SELECTOR;
+
+/// Background color of the HUD.
+/// @discussion Default: [UIColor whiteColor].
+@property (strong, nonatomic, nonnull) UIColor *backgroundColor UI_APPEARANCE_SELECTOR;
+
+/// Foreground color used for content in the HUD.
+/// @discussion Default: [UIColor blackColor].
+@property (strong, nonatomic, nonnull) UIColor *foregroundColor UI_APPEARANCE_SELECTOR;
+
+/// Color for any foreground images in the HUD.
+/// @discussion Default: same as foregroundColor.
+@property (strong, nonatomic, nullable) UIColor *foregroundImageColor UI_APPEARANCE_SELECTOR;
+
+/// Color for the background layer behind the HUD.
+/// @discussion Default: [UIColor colorWithWhite:0 alpha:0.4].
+@property (strong, nonatomic, nonnull) UIColor *backgroundLayerColor UI_APPEARANCE_SELECTOR;
+
+/// Size of any images displayed within the HUD.
+/// @discussion Default: 28x28 pt.
+@property (assign, nonatomic) CGSize imageViewSize UI_APPEARANCE_SELECTOR;
+
+/// Indicates whether images within the HUD should be tinted.
+/// @discussion Default: YES.
+@property (assign, nonatomic) BOOL shouldTintImages UI_APPEARANCE_SELECTOR;
+
+/// The image displayed when showing informational messages.
+/// @discussion Default: info.circle from SF Symbols (iOS 13+) or the bundled info image provided by Freepik.
+@property (strong, nonatomic, nonnull) UIImage *infoImage UI_APPEARANCE_SELECTOR;
+
+/// The image displayed when showing success messages.
+/// @discussion Default: checkmark from SF Symbols (iOS 13+) or the bundled success image provided by Freepik.
+@property (strong, nonatomic, nonnull) UIImage *successImage UI_APPEARANCE_SELECTOR;
+
+/// The image displayed when showing error messages.
+/// @discussion Default: xmark from SF Symbols (iOS 13+) or the bundled error image provided by Freepik.
+@property (strong, nonatomic, nonnull) UIImage *errorImage UI_APPEARANCE_SELECTOR;
+
+/// A specific view for extensions. This property is only used if #define SV_APP_EXTENSIONS is set.
+/// @discussion Default: nil.
+@property (strong, nonatomic, nonnull) UIView *viewForExtension UI_APPEARANCE_SELECTOR;
+
+/// The interval in seconds to wait before displaying the HUD. If the HUD is displayed before this time elapses, this timer is reset.
+/// @discussion Default: 0 seconds.
+@property (assign, nonatomic) NSTimeInterval graceTimeInterval;
+
+/// The minimum amount of time in seconds the HUD will display.
+/// @discussion Default: 5.0 seconds.
+@property (assign, nonatomic) NSTimeInterval minimumDismissTimeInterval;
+
+/// The maximum amount of time in seconds the HUD will display.
+/// @discussion Default: CGFLOAT_MAX.
+@property (assign, nonatomic) NSTimeInterval maximumDismissTimeInterval;
+
+/// Offset from the center position, can be used to adjust the HUD position.
+/// @discussion Default: 0, 0.
+@property (assign, nonatomic) UIOffset offsetFromCenter UI_APPEARANCE_SELECTOR;
+
+/// Duration of the fade-in animation when showing the HUD.
+/// @discussion Default: 0.15.
+@property (assign, nonatomic) NSTimeInterval fadeInAnimationDuration UI_APPEARANCE_SELECTOR;
+
+/// Duration of the fade-out animation when hiding the HUD.
+/// @discussion Default: 0.15.
+@property (assign, nonatomic) NSTimeInterval fadeOutAnimationDuration UI_APPEARANCE_SELECTOR;
+
+/// The maximum window level on which the HUD can be displayed.
+/// @discussion Default: UIWindowLevelNormal.
+@property (assign, nonatomic) UIWindowLevel maxSupportedWindowLevel;
+
+/// Indicates if haptic feedback should be used.
+/// @discussion Default: NO.
+@property (assign, nonatomic) BOOL hapticsEnabled;
+
+/// Indicates if motion effects should be applied to the HUD.
+/// @discussion Default: YES.
+@property (assign, nonatomic) BOOL motionEffectEnabled;
+
+@property (class, strong, nonatomic, readonly, nonnull) NSBundle *imageBundle;
+
+/// Sets the default style for the HUD.
+/// @param style The desired style for the HUD.
++ (void)setDefaultStyle:(SVProgressHUDStyle)style;
+
+/// Sets the default mask type for the HUD.
+/// @param maskType The mask type to apply.
++ (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType;
+
+/// Sets the default animation type for the HUD.
+/// @param type The desired animation type.
++ (void)setDefaultAnimationType:(SVProgressHUDAnimationType)type;
+
+/// Sets the container view for the HUD.
+/// @param containerView The view to contain the HUD.
++ (void)setContainerView:(nullable UIView*)containerView;
+
+/// Sets the minimum size for the HUD.
+/// @param minimumSize The minimum size for the HUD.
++ (void)setMinimumSize:(CGSize)minimumSize;
+
+/// Sets the ring thickness for the HUD.
+/// @param ringThickness Thickness of the ring.
++ (void)setRingThickness:(CGFloat)ringThickness;
+
+/// Sets the ring radius for the HUD.
+/// @param radius Radius of the ring.
++ (void)setRingRadius:(CGFloat)radius;
+
+/// Sets the no text ring radius for the HUD.
+/// @param radius Radius of the ring when no text is displayed.
++ (void)setRingNoTextRadius:(CGFloat)radius;
+
+/// Sets the corner radius for the HUD.
+/// @param cornerRadius Desired corner radius.
++ (void)setCornerRadius:(CGFloat)cornerRadius;
+
+/// Sets the border color for the HUD.
+/// @param color Desired border color.
++ (void)setBorderColor:(nonnull UIColor*)color;
+
+/// Sets the border width for the HUD.
+/// @param width Desired border width.
++ (void)setBorderWidth:(CGFloat)width;
+
+/// Sets the font for the HUD's text.
+/// @param font Desired font for the text.
++ (void)setFont:(nonnull UIFont*)font;
+
+/// Sets the foreground color for the HUD.
+/// @param color Desired foreground color.
+/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
++ (void)setForegroundColor:(nonnull UIColor*)color;
+
+/// Sets the foreground image color for the HUD.
+/// @param color Desired color for the image.
+/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
++ (void)setForegroundImageColor:(nullable UIColor*)color;
+
+/// Sets the background color for the HUD.
+/// @param color Desired background color.
+/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
++ (void)setBackgroundColor:(nonnull UIColor*)color;
+
+/// Sets a custom blur effect for the HUD view.
+/// @param blurEffect Desired blur effect.
+/// @discussion These implicitly set the HUD's style to `SVProgressHUDStyleCustom`.
++ (void)setHudViewCustomBlurEffect:(nullable UIBlurEffect*)blurEffect;
+
+/// Sets the background layer color for the HUD.
+/// @param color Desired color for the background layer.
++ (void)setBackgroundLayerColor:(nonnull UIColor*)color;
+
+/// Sets the size for the HUD's image view.
+/// @param size Desired size for the image view.
++ (void)setImageViewSize:(CGSize)size;
+
+/// Determines if images should be tinted in the HUD.
+/// @param shouldTintImages Whether images should be tinted.
++ (void)setShouldTintImages:(BOOL)shouldTintImages;
+
+/// Sets the info image for the HUD.
+/// @param image The desired info image.
++ (void)setInfoImage:(nonnull UIImage*)image;
+
+/// Sets the success image for the HUD.
+/// @param image The desired success image.
++ (void)setSuccessImage:(nonnull UIImage*)image;
+
+/// Sets the error image for the HUD.
+/// @param image The desired error image.
++ (void)setErrorImage:(nonnull UIImage*)image;
+
+/// Sets the view for extensions.
+/// @param view The desired view for extensions.
++ (void)setViewForExtension:(nonnull UIView*)view;
+
+/// Sets the grace time interval for the HUD.
+/// @param interval Desired grace time interval.
++ (void)setGraceTimeInterval:(NSTimeInterval)interval;
+
+/// Sets the minimum dismiss time interval.
+/// @param interval The minimum time interval, in seconds, that the HUD should be displayed.
++ (void)setMinimumDismissTimeInterval:(NSTimeInterval)interval;
+
+/// Sets the maximum dismiss time interval.
+/// @param interval The maximum time interval, in seconds, that the HUD should be displayed.
++ (void)setMaximumDismissTimeInterval:(NSTimeInterval)interval;
+
+/// Sets the fade-in animation duration.
+/// @param duration The duration, in seconds, for the fade-in animation.
++ (void)setFadeInAnimationDuration:(NSTimeInterval)duration;
+
+/// Sets the fade-out animation duration.
+/// @param duration The duration, in seconds, for the fade-out animation.
++ (void)setFadeOutAnimationDuration:(NSTimeInterval)duration;
+
+/// Sets the max supported window level.
+/// @param windowLevel The UIWindowLevel to which the HUD should be displayed.
++ (void)setMaxSupportedWindowLevel:(UIWindowLevel)windowLevel;
+
+/// Determines if haptics are enabled.
+/// @param hapticsEnabled A boolean that determines if haptic feedback is enabled.
++ (void)setHapticsEnabled:(BOOL)hapticsEnabled;
+
+/// Determines if motion effect is enabled.
+/// @param motionEffectEnabled A boolean that determines if motion effects are enabled.
++ (void)setMotionEffectEnabled:(BOOL)motionEffectEnabled;
+
+
+#pragma mark - Show Methods
+
+/// Shows the HUD without any additional status message.
++ (void)show;
+
+/// Shows the HUD with a provided status message.
+/// @param status The message to be displayed alongside the HUD.
++ (void)showWithStatus:(nullable NSString*)status;
+
+/// Display methods to show progress on the HUD.
+
+/// Shows the HUD with a progress indicator.
+/// @param progress A float value between 0.0 and 1.0 indicating the progress.
++ (void)showProgress:(float)progress;
+
+/// Shows the HUD with a progress indicator and a provided status message.
+/// @param progress A float value between 0.0 and 1.0 indicating the progress.
+/// @param status The message to be displayed alongside the progress indicator.
++ (void)showProgress:(float)progress status:(nullable NSString*)status;
+
+/// Updates the current status of the loading HUD.
+/// @param status The new status message to update the HUD with.
++ (void)setStatus:(nullable NSString*)status;
+
+/// Shows an info status with the provided message.
+/// @param status The info message to be displayed.
++ (void)showInfoWithStatus:(nullable NSString*)status;
+
+/// Shows a success status with the provided message.
+/// @param status The success message to be displayed.
++ (void)showSuccessWithStatus:(nullable NSString*)status;
+
+/// Shows an error status with the provided message.
+/// @param status The error message to be displayed.
++ (void)showErrorWithStatus:(nullable NSString*)status;
+
+/// Shows a custom image with the provided status message.
+/// @param image The custom image to be displayed.
+/// @param status The message to accompany the custom image.
++ (void)showImage:(nonnull UIImage*)image status:(nullable NSString*)status;
+
+/// Sets the offset from the center for the HUD.
+/// @param offset The UIOffset value indicating how much the HUD should be offset from its center position.
++ (void)setOffsetFromCenter:(UIOffset)offset;
+
+/// Resets the offset to center the HUD.
++ (void)resetOffsetFromCenter;
+
+/// Decreases the activity count, dismissing the HUD if count reaches 0.
++ (void)popActivity;
+
+/// Dismisses the HUD immediately.
++ (void)dismiss;
+
+/// Dismisses the HUD and triggers a completion block.
+/// @param completion A block that gets executed after the HUD is dismissed.
++ (void)dismissWithCompletion:(nullable SVProgressHUDDismissCompletion)completion;
+
+/// Dismisses the HUD after a specified delay.
+/// @param delay The time in seconds after which the HUD should be dismissed.
++ (void)dismissWithDelay:(NSTimeInterval)delay;
+
+/// Dismisses the HUD after a specified delay and triggers a completion block.
+/// @param delay The time in seconds after which the HUD should be dismissed.
+/// @param completion A block that gets executed after the HUD is dismissed.
++ (void)dismissWithDelay:(NSTimeInterval)delay completion:(nullable SVProgressHUDDismissCompletion)completion;
+
+/// Checks if the HUD is currently visible.
+/// @return A boolean value indicating whether the HUD is visible.
++ (BOOL)isVisible;
+
+/// Calculates the display duration based on a given string's length.
+/// @param string The string whose length determines the display duration.
+/// @return A time interval representing the display duration.
++ (NSTimeInterval)displayDurationForString:(nullable NSString*)string;
+
+@end
+
--- /dev/null
+//
+// SVProgressHUD.h
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2011-2023 Sam Vermette and contributors. All rights reserved.
+//
+
+#if !__has_feature(objc_arc)
+#error SVProgressHUD is ARC only. Either turn on ARC for the project or use -fobjc-arc flag
+#endif
+
+#import "SVProgressHUD.h"
+#import "SVIndefiniteAnimatedView.h"
+#import "SVProgressAnimatedView.h"
+#import "SVRadialGradientLayer.h"
+
+NSString * const SVProgressHUDDidReceiveTouchEventNotification = @"SVProgressHUDDidReceiveTouchEventNotification";
+NSString * const SVProgressHUDDidTouchDownInsideNotification = @"SVProgressHUDDidTouchDownInsideNotification";
+NSString * const SVProgressHUDWillDisappearNotification = @"SVProgressHUDWillDisappearNotification";
+NSString * const SVProgressHUDDidDisappearNotification = @"SVProgressHUDDidDisappearNotification";
+NSString * const SVProgressHUDWillAppearNotification = @"SVProgressHUDWillAppearNotification";
+NSString * const SVProgressHUDDidAppearNotification = @"SVProgressHUDDidAppearNotification";
+
+NSString * const SVProgressHUDStatusUserInfoKey = @"SVProgressHUDStatusUserInfoKey";
+
+static const CGFloat SVProgressHUDParallaxDepthPoints = 10.0f;
+static const CGFloat SVProgressHUDUndefinedProgress = -1;
+static const CGFloat SVProgressHUDDefaultAnimationDuration = 0.15f;
+static const CGFloat SVProgressHUDVerticalSpacing = 12.0f;
+static const CGFloat SVProgressHUDHorizontalSpacing = 12.0f;
+static const CGFloat SVProgressHUDLabelSpacing = 8.0f;
+
+
+@interface SVProgressHUD ()
+
+@property (nonatomic, strong) NSTimer *graceTimer;
+@property (nonatomic, strong) NSTimer *fadeOutTimer;
+
+@property (nonatomic, strong) UIControl *controlView;
+@property (nonatomic, strong) UIView *backgroundView;
+@property (nonatomic, strong) SVRadialGradientLayer *backgroundRadialGradientLayer;
+@property (nonatomic, strong) UIVisualEffectView *hudView;
+@property (nonatomic, strong) UIBlurEffect *hudViewCustomBlurEffect;
+@property (nonatomic, strong) UILabel *statusLabel;
+@property (nonatomic, strong) UIImageView *imageView;
+
+@property (nonatomic, strong) UIView *indefiniteAnimatedView;
+@property (nonatomic, strong) SVProgressAnimatedView *ringView;
+@property (nonatomic, strong) SVProgressAnimatedView *backgroundRingView;
+
+@property (nonatomic, readwrite) CGFloat progress;
+@property (nonatomic, readwrite) NSUInteger activityCount;
+
+@property (nonatomic, readonly) CGFloat visibleKeyboardHeight;
+@property (nonatomic, readonly) UIWindow *frontWindow;
+
+#if TARGET_OS_IOS
+@property (nonatomic, strong) UINotificationFeedbackGenerator *hapticGenerator;
+#endif
+
+@end
+
+@implementation SVProgressHUD {
+ BOOL _isInitializing;
+}
+
++ (SVProgressHUD*)sharedView {
+ static dispatch_once_t once;
+
+ static SVProgressHUD *sharedView;
+#if !defined(SV_APP_EXTENSIONS)
+ dispatch_once(&once, ^{ sharedView = [[self alloc] initWithFrame:[SVProgressHUD mainWindow].bounds]; });
+#else
+ dispatch_once(&once, ^{ sharedView = [[self alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; });
+#endif
+ return sharedView;
+}
+
++ (UIWindow *)mainWindow {
+ if (@available(iOS 13.0, *)) {
+ for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
+ if (windowScene.activationState == UISceneActivationStateForegroundActive) {
+ return windowScene.windows.firstObject;
+ }
+ }
+ // If a window has not been returned by now, the first scene's window is returned (regardless of activationState).
+ UIWindowScene *windowScene = (UIWindowScene *)[[UIApplication sharedApplication].connectedScenes allObjects].firstObject;
+ return windowScene.windows.firstObject;
+ } else {
+#if TARGET_OS_IOS
+ return [[[UIApplication sharedApplication] delegate] window];
+#else
+ return [UIApplication sharedApplication].keyWindow;
+#endif
+ }
+}
+
++ (NSBundle *)imageBundle {
+#if defined(SWIFTPM_MODULE_BUNDLE)
+ NSBundle *bundle = SWIFTPM_MODULE_BUNDLE;
+#else
+ NSBundle *bundle = [NSBundle bundleForClass:[SVProgressHUD class]];
+#endif
+ NSURL *url = [bundle URLForResource:@"SVProgressHUD" withExtension:@"bundle"];
+ return [NSBundle bundleWithURL:url];
+ }
+
+#pragma mark - Setters
+
++ (void)setStatus:(NSString*)status {
+ [[self sharedView] setStatus:status];
+}
+
++ (void)setDefaultStyle:(SVProgressHUDStyle)style {
+ [self sharedView].defaultStyle = style;
+}
+
++ (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType {
+ [self sharedView].defaultMaskType = maskType;
+}
+
++ (void)setDefaultAnimationType:(SVProgressHUDAnimationType)type {
+ [self sharedView].defaultAnimationType = type;
+}
+
++ (void)setContainerView:(nullable UIView*)containerView {
+ [self sharedView].containerView = containerView;
+}
+
++ (void)setMinimumSize:(CGSize)minimumSize {
+ [self sharedView].minimumSize = minimumSize;
+}
+
++ (void)setRingThickness:(CGFloat)ringThickness {
+ [self sharedView].ringThickness = ringThickness;
+}
+
++ (void)setRingRadius:(CGFloat)radius {
+ [self sharedView].ringRadius = radius;
+}
+
++ (void)setRingNoTextRadius:(CGFloat)radius {
+ [self sharedView].ringNoTextRadius = radius;
+}
+
++ (void)setCornerRadius:(CGFloat)cornerRadius {
+ [self sharedView].cornerRadius = cornerRadius;
+}
+
++ (void)setBorderColor:(nonnull UIColor*)color {
+ [self sharedView].hudView.layer.borderColor = color.CGColor;
+}
+
++ (void)setBorderWidth:(CGFloat)width {
+ [self sharedView].hudView.layer.borderWidth = width;
+}
+
++ (void)setFont:(UIFont*)font {
+ [self sharedView].font = font;
+}
+
++ (void)setForegroundColor:(UIColor*)color {
+ [self sharedView].foregroundColor = color;
+ [self setDefaultStyle:SVProgressHUDStyleCustom];
+}
+
++ (void)setForegroundImageColor:(UIColor *)color {
+ [self sharedView].foregroundImageColor = color;
+ [self setDefaultStyle:SVProgressHUDStyleCustom];
+}
+
++ (void)setBackgroundColor:(UIColor*)color {
+ [self sharedView].backgroundColor = color;
+ [self setDefaultStyle:SVProgressHUDStyleCustom];
+}
+
++ (void)setHudViewCustomBlurEffect:(UIBlurEffect*)blurEffect {
+ [self sharedView].hudViewCustomBlurEffect = blurEffect;
+ [self setDefaultStyle:SVProgressHUDStyleCustom];
+}
+
++ (void)setBackgroundLayerColor:(UIColor*)color {
+ [self sharedView].backgroundLayerColor = color;
+}
+
++ (void)setImageViewSize:(CGSize)size {
+ [self sharedView].imageViewSize = size;
+}
+
++ (void)setShouldTintImages:(BOOL)shouldTintImages {
+ [self sharedView].shouldTintImages = shouldTintImages;
+}
+
++ (void)setInfoImage:(UIImage*)image {
+ [self sharedView].infoImage = image;
+}
+
++ (void)setSuccessImage:(UIImage*)image {
+ [self sharedView].successImage = image;
+}
+
++ (void)setErrorImage:(UIImage*)image {
+ [self sharedView].errorImage = image;
+}
+
++ (void)setViewForExtension:(UIView*)view {
+ [self sharedView].viewForExtension = view;
+}
+
++ (void)setGraceTimeInterval:(NSTimeInterval)interval {
+ [self sharedView].graceTimeInterval = interval;
+}
+
++ (void)setMinimumDismissTimeInterval:(NSTimeInterval)interval {
+ [self sharedView].minimumDismissTimeInterval = interval;
+}
+
++ (void)setMaximumDismissTimeInterval:(NSTimeInterval)interval {
+ [self sharedView].maximumDismissTimeInterval = interval;
+}
+
++ (void)setFadeInAnimationDuration:(NSTimeInterval)duration {
+ [self sharedView].fadeInAnimationDuration = duration;
+}
+
++ (void)setFadeOutAnimationDuration:(NSTimeInterval)duration {
+ [self sharedView].fadeOutAnimationDuration = duration;
+}
+
++ (void)setMaxSupportedWindowLevel:(UIWindowLevel)windowLevel {
+ [self sharedView].maxSupportedWindowLevel = windowLevel;
+}
+
++ (void)setHapticsEnabled:(BOOL)hapticsEnabled {
+ [self sharedView].hapticsEnabled = hapticsEnabled;
+}
+
++ (void)setMotionEffectEnabled:(BOOL)motionEffectEnabled {
+ [self sharedView].motionEffectEnabled = motionEffectEnabled;
+}
+
+#pragma mark - Show Methods
+
++ (void)show {
+ [self showWithStatus:nil];
+}
+
++ (void)showWithStatus:(NSString*)status {
+ [self showProgress:SVProgressHUDUndefinedProgress status:status];
+}
+
++ (void)showProgress:(float)progress {
+ [self showProgress:progress status:nil];
+}
+
++ (void)showProgress:(float)progress status:(NSString*)status {
+ [[self sharedView] showProgress:progress status:status];
+}
+
+
+#pragma mark - Show, then automatically dismiss methods
+
++ (void)showInfoWithStatus:(NSString*)status {
+ [self showImage:[self sharedView].infoImage status:status];
+
+#if TARGET_OS_IOS
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[self sharedView].hapticGenerator notificationOccurred:UINotificationFeedbackTypeWarning];
+ });
+#endif
+}
+
++ (void)showSuccessWithStatus:(NSString*)status {
+ [self showImage:[self sharedView].successImage status:status];
+
+#if TARGET_OS_IOS
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[self sharedView].hapticGenerator notificationOccurred:UINotificationFeedbackTypeSuccess];
+ });
+#endif
+}
+
++ (void)showErrorWithStatus:(NSString*)status {
+ [self showImage:[self sharedView].errorImage status:status];
+
+#if TARGET_OS_IOS
+ dispatch_async(dispatch_get_main_queue(), ^{
+ [[self sharedView].hapticGenerator notificationOccurred:UINotificationFeedbackTypeError];
+ });
+#endif
+}
+
++ (void)showImage:(UIImage*)image status:(NSString*)status {
+ NSTimeInterval displayInterval = [self displayDurationForString:status];
+ [[self sharedView] showImage:image status:status duration:displayInterval];
+}
+
+
+#pragma mark - Dismiss Methods
+
++ (void)popActivity {
+ if([self sharedView].activityCount > 0) {
+ [self sharedView].activityCount--;
+ }
+ if([self sharedView].activityCount == 0) {
+ [[self sharedView] dismiss];
+ }
+}
+
++ (void)dismiss {
+ [self dismissWithDelay:0.0 completion:nil];
+}
+
++ (void)dismissWithCompletion:(SVProgressHUDDismissCompletion)completion {
+ [self dismissWithDelay:0.0 completion:completion];
+}
+
++ (void)dismissWithDelay:(NSTimeInterval)delay {
+ [self dismissWithDelay:delay completion:nil];
+}
+
++ (void)dismissWithDelay:(NSTimeInterval)delay completion:(SVProgressHUDDismissCompletion)completion {
+ [[self sharedView] dismissWithDelay:delay completion:completion];
+}
+
+
+#pragma mark - Offset
+
++ (void)setOffsetFromCenter:(UIOffset)offset {
+ [self sharedView].offsetFromCenter = offset;
+}
+
++ (void)resetOffsetFromCenter {
+ [self setOffsetFromCenter:UIOffsetZero];
+}
+
+
+#pragma mark - Instance Methods
+
+- (instancetype)initWithFrame:(CGRect)frame {
+ if((self = [super initWithFrame:frame])) {
+ _isInitializing = YES;
+
+ self.userInteractionEnabled = NO;
+ self.activityCount = 0;
+
+ self.backgroundView.alpha = 0.0f;
+ self.imageView.alpha = 0.0f;
+ self.statusLabel.alpha = 0.0f;
+ self.indefiniteAnimatedView.alpha = 0.0f;
+ self.ringView.alpha = self.backgroundRingView.alpha = 0.0f;
+
+
+ _backgroundColor = [UIColor whiteColor];
+ _foregroundColor = [UIColor blackColor];
+ _backgroundLayerColor = [UIColor colorWithWhite:0 alpha:0.4];
+
+ // Set default values
+ _defaultMaskType = SVProgressHUDMaskTypeNone;
+ _defaultStyle = SVProgressHUDStyleAutomatic;
+ _defaultAnimationType = SVProgressHUDAnimationTypeFlat;
+ _minimumSize = CGSizeZero;
+ _font = [UIFont preferredFontForTextStyle:UIFontTextStyleSubheadline];
+
+ _imageViewSize = CGSizeMake(28.0f, 28.0f);
+ _shouldTintImages = YES;
+
+ NSBundle *imageBundle = [SVProgressHUD imageBundle];
+
+ if (@available(iOS 13.0, *)) {
+ _infoImage = [UIImage systemImageNamed:@"info.circle"];
+ _successImage = [UIImage systemImageNamed:@"checkmark"];
+ _errorImage = [UIImage systemImageNamed:@"xmark"];
+ } else {
+ _infoImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"info" ofType:@"png"]];
+ _successImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"success" ofType:@"png"]];
+ _errorImage = [UIImage imageWithContentsOfFile:[imageBundle pathForResource:@"error" ofType:@"png"]];
+ }
+
+ _ringThickness = 2.0f;
+ _ringRadius = 18.0f;
+ _ringNoTextRadius = 24.0f;
+
+ _cornerRadius = 14.0f;
+
+ _graceTimeInterval = 0.0f;
+ _minimumDismissTimeInterval = 5.0;
+ _maximumDismissTimeInterval = CGFLOAT_MAX;
+
+ _fadeInAnimationDuration = SVProgressHUDDefaultAnimationDuration;
+ _fadeOutAnimationDuration = SVProgressHUDDefaultAnimationDuration;
+
+ _maxSupportedWindowLevel = UIWindowLevelNormal;
+
+ _hapticsEnabled = NO;
+ _motionEffectEnabled = YES;
+
+ // Accessibility support
+ self.accessibilityIdentifier = @"SVProgressHUD";
+ self.isAccessibilityElement = YES;
+
+ _isInitializing = NO;
+ }
+ return self;
+}
+
+- (void)updateHUDFrame {
+ // Check if an image or progress ring is displayed
+ BOOL imageUsed = (self.imageView.image) && !(self.imageView.hidden) && (self.imageViewSize.height > 0 && self.imageViewSize.width > 0);
+ BOOL progressUsed = self.imageView.hidden;
+
+ // Calculate size of string
+ CGRect labelRect = CGRectZero;
+ CGFloat labelHeight = 0.0f;
+ CGFloat labelWidth = 0.0f;
+
+ if(self.statusLabel.text) {
+ CGSize constraintSize = CGSizeMake(200.0f, 300.0f);
+ labelRect = [self.statusLabel.text boundingRectWithSize:constraintSize
+ options:(NSStringDrawingOptions)(NSStringDrawingUsesFontLeading | NSStringDrawingTruncatesLastVisibleLine | NSStringDrawingUsesLineFragmentOrigin)
+ attributes:@{NSFontAttributeName: self.statusLabel.font}
+ context:NULL];
+ labelHeight = ceilf(CGRectGetHeight(labelRect));
+ labelWidth = ceilf(CGRectGetWidth(labelRect));
+ }
+
+ // Calculate hud size based on content
+ // For the beginning use default values, these
+ // might get update if string is too large etc.
+ CGFloat hudWidth;
+ CGFloat hudHeight;
+
+ CGFloat contentWidth = 0.0f;
+ CGFloat contentHeight = 0.0f;
+
+ if(imageUsed || progressUsed) {
+ contentWidth = CGRectGetWidth(imageUsed ? self.imageView.frame : self.indefiniteAnimatedView.frame);
+ contentHeight = CGRectGetHeight(imageUsed ? self.imageView.frame : self.indefiniteAnimatedView.frame);
+ }
+
+ // |-spacing-content-spacing-|
+ hudWidth = SVProgressHUDHorizontalSpacing + MAX(labelWidth, contentWidth) + SVProgressHUDHorizontalSpacing;
+
+ // |-spacing-content-(labelSpacing-label-)spacing-|
+ hudHeight = SVProgressHUDVerticalSpacing + labelHeight + contentHeight + SVProgressHUDVerticalSpacing;
+ if(self.statusLabel.text && (imageUsed || progressUsed)){
+ // Add spacing if both content and label are used
+ hudHeight += SVProgressHUDLabelSpacing;
+ }
+
+ // Update values on subviews
+ self.hudView.bounds = CGRectMake(0.0f, 0.0f, MAX(self.minimumSize.width, hudWidth), MAX(self.minimumSize.height, hudHeight));
+
+ // Animate value update
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ // Spinner and image view
+ CGFloat centerY;
+ if(self.statusLabel.text) {
+ CGFloat yOffset = MAX(SVProgressHUDVerticalSpacing, (self.minimumSize.height - contentHeight - SVProgressHUDLabelSpacing - labelHeight) / 2.0f);
+ centerY = yOffset + contentHeight / 2.0f;
+ } else {
+ centerY = CGRectGetMidY(self.hudView.bounds);
+ }
+ self.indefiniteAnimatedView.center = CGPointMake(CGRectGetMidX(self.hudView.bounds), centerY);
+ if(self.progress != SVProgressHUDUndefinedProgress) {
+ self.backgroundRingView.center = self.ringView.center = CGPointMake(CGRectGetMidX(self.hudView.bounds), centerY);
+ }
+ self.imageView.center = CGPointMake(CGRectGetMidX(self.hudView.bounds), centerY);
+
+ // Label
+ if(imageUsed || progressUsed) {
+ centerY = CGRectGetMaxY(imageUsed ? self.imageView.frame : self.indefiniteAnimatedView.frame) + SVProgressHUDLabelSpacing + labelHeight / 2.0f;
+ } else {
+ centerY = CGRectGetMidY(self.hudView.bounds);
+ }
+ self.statusLabel.frame = labelRect;
+ self.statusLabel.center = CGPointMake(CGRectGetMidX(self.hudView.bounds), centerY);
+
+ [CATransaction commit];
+}
+
+#if TARGET_OS_IOS
+- (void)updateMotionEffectForOrientation:(UIInterfaceOrientation)orientation {
+ bool isPortrait = UIInterfaceOrientationIsPortrait(orientation);
+ UIInterpolatingMotionEffectType xMotionEffectType = isPortrait ? UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis : UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis;
+ UIInterpolatingMotionEffectType yMotionEffectType = isPortrait ? UIInterpolatingMotionEffectTypeTiltAlongVerticalAxis : UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis;
+ [self updateMotionEffectForXMotionEffectType:xMotionEffectType yMotionEffectType:yMotionEffectType];
+}
+#endif
+
+- (void)updateMotionEffectForXMotionEffectType:(UIInterpolatingMotionEffectType)xMotionEffectType yMotionEffectType:(UIInterpolatingMotionEffectType)yMotionEffectType {
+ UIInterpolatingMotionEffect *effectX = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.x" type:xMotionEffectType];
+ effectX.minimumRelativeValue = @(-SVProgressHUDParallaxDepthPoints);
+ effectX.maximumRelativeValue = @(SVProgressHUDParallaxDepthPoints);
+
+ UIInterpolatingMotionEffect *effectY = [[UIInterpolatingMotionEffect alloc] initWithKeyPath:@"center.y" type:yMotionEffectType];
+ effectY.minimumRelativeValue = @(-SVProgressHUDParallaxDepthPoints);
+ effectY.maximumRelativeValue = @(SVProgressHUDParallaxDepthPoints);
+
+ UIMotionEffectGroup *effectGroup = [UIMotionEffectGroup new];
+ effectGroup.motionEffects = @[effectX, effectY];
+
+ // Clear old motion effect, then add new motion effects
+ self.hudView.motionEffects = @[];
+ [self.hudView addMotionEffect:effectGroup];
+}
+
+- (void)updateViewHierarchy {
+ // Add the overlay to the application window if necessary
+ if(!self.controlView.superview) {
+ if(self.containerView){
+ [self.containerView addSubview:self.controlView];
+ } else {
+#if !defined(SV_APP_EXTENSIONS)
+ [self.frontWindow addSubview:self.controlView];
+#else
+ // If SVProgressHUD is used inside an app extension add it to the given view
+ if(self.viewForExtension) {
+ [self.viewForExtension addSubview:self.controlView];
+ }
+#endif
+ }
+ } else {
+ // The HUD is already on screen, but maybe not in front. Therefore
+ // ensure that overlay will be on top of rootViewController (which may
+ // be changed during runtime).
+ [self.controlView.superview bringSubviewToFront:self.controlView];
+ }
+
+ // Add self to the overlay view
+ if(!self.superview) {
+ [self.controlView addSubview:self];
+ }
+}
+
+- (void)setStatus:(NSString*)status {
+ self.statusLabel.text = status;
+ self.statusLabel.hidden = status.length == 0;
+ [self updateHUDFrame];
+}
+
+- (void)setGraceTimer:(NSTimer*)timer {
+ if(_graceTimer) {
+ [_graceTimer invalidate];
+ _graceTimer = nil;
+ }
+ if(timer) {
+ _graceTimer = timer;
+ }
+}
+
+- (void)setFadeOutTimer:(NSTimer*)timer {
+ if(_fadeOutTimer) {
+ [_fadeOutTimer invalidate];
+ _fadeOutTimer = nil;
+ }
+ if(timer) {
+ _fadeOutTimer = timer;
+ }
+}
+
+
+#pragma mark - Notifications and their handling
+
+- (void)registerNotifications {
+#if TARGET_OS_IOS
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIApplicationDidChangeStatusBarOrientationNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIKeyboardWillHideNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIKeyboardDidHideNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIKeyboardWillShowNotification
+ object:nil];
+
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIKeyboardDidShowNotification
+ object:nil];
+#endif
+ [[NSNotificationCenter defaultCenter] addObserver:self
+ selector:@selector(positionHUD:)
+ name:UIApplicationDidBecomeActiveNotification
+ object:nil];
+}
+
+- (NSDictionary*)notificationUserInfo {
+ return (self.statusLabel.text ? @{SVProgressHUDStatusUserInfoKey : self.statusLabel.text} : nil);
+}
+
+- (void)positionHUD:(NSNotification*)notification {
+ CGFloat keyboardHeight = 0.0f;
+ double animationDuration = 0.0;
+
+#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
+ self.frame = [SVProgressHUD mainWindow].bounds;
+ UIInterfaceOrientation orientation = UIApplication.sharedApplication.statusBarOrientation;
+#elif !defined(SV_APP_EXTENSIONS) && !TARGET_OS_IOS
+ self.frame = [SVProgressHUD mainWindow].bounds;
+#else
+ if (self.viewForExtension) {
+ self.frame = self.viewForExtension.frame;
+ } else {
+ self.frame = UIScreen.mainScreen.bounds;
+ }
+#if TARGET_OS_IOS
+ UIInterfaceOrientation orientation = CGRectGetWidth(self.frame) > CGRectGetHeight(self.frame) ? UIInterfaceOrientationLandscapeLeft : UIInterfaceOrientationPortrait;
+#endif
+#endif
+
+#if TARGET_OS_IOS
+ // Get keyboardHeight in regard to current state
+ if(notification) {
+ NSDictionary* keyboardInfo = [notification userInfo];
+ CGRect keyboardFrame = [keyboardInfo[UIKeyboardFrameBeginUserInfoKey] CGRectValue];
+ animationDuration = [keyboardInfo[UIKeyboardAnimationDurationUserInfoKey] doubleValue];
+
+ if(notification.name == UIKeyboardWillShowNotification || notification.name == UIKeyboardDidShowNotification) {
+ keyboardHeight = CGRectGetWidth(keyboardFrame);
+
+ if(UIInterfaceOrientationIsPortrait(orientation)) {
+ keyboardHeight = CGRectGetHeight(keyboardFrame);
+ }
+ }
+ } else {
+ keyboardHeight = self.visibleKeyboardHeight;
+ }
+#endif
+
+ // Get the currently active frame of the display (depends on orientation)
+ CGRect orientationFrame = self.bounds;
+
+#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
+ CGRect statusBarFrame = UIApplication.sharedApplication.statusBarFrame;
+#else
+ CGRect statusBarFrame = CGRectZero;
+#endif
+
+ if (_motionEffectEnabled) {
+#if TARGET_OS_IOS
+ // Update the motion effects in regard to orientation
+ [self updateMotionEffectForOrientation:orientation];
+#else
+ [self updateMotionEffectForXMotionEffectType:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis yMotionEffectType:UIInterpolatingMotionEffectTypeTiltAlongHorizontalAxis];
+#endif
+ }
+
+ // Calculate available height for display
+ CGFloat activeHeight = CGRectGetHeight(orientationFrame);
+ if(keyboardHeight > 0) {
+ activeHeight += CGRectGetHeight(statusBarFrame) * 2;
+ }
+ activeHeight -= keyboardHeight;
+
+ CGFloat posX = CGRectGetMidX(orientationFrame);
+ CGFloat posY = floorf(activeHeight*0.45f);
+
+ CGFloat rotateAngle = 0.0;
+ CGPoint newCenter = CGPointMake(posX, posY);
+
+ if(notification) {
+ // Animate update if notification was present
+ [UIView animateWithDuration:animationDuration
+ delay:0
+ options:(UIViewAnimationOptions) (UIViewAnimationOptionAllowUserInteraction | UIViewAnimationOptionBeginFromCurrentState)
+ animations:^{
+ [self moveToPoint:newCenter rotateAngle:rotateAngle];
+ [self.hudView setNeedsDisplay];
+ } completion:nil];
+ } else {
+ [self moveToPoint:newCenter rotateAngle:rotateAngle];
+ }
+}
+
+- (void)moveToPoint:(CGPoint)newCenter rotateAngle:(CGFloat)angle {
+ self.hudView.transform = CGAffineTransformMakeRotation(angle);
+ if (self.containerView) {
+ self.hudView.center = CGPointMake(self.containerView.center.x + self.offsetFromCenter.horizontal, self.containerView.center.y + self.offsetFromCenter.vertical);
+ } else {
+ self.hudView.center = CGPointMake(newCenter.x + self.offsetFromCenter.horizontal, newCenter.y + self.offsetFromCenter.vertical);
+ }
+}
+
+
+#pragma mark - Event handling
+
+- (void)controlViewDidReceiveTouchEvent:(id)sender forEvent:(UIEvent*)event {
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDDidReceiveTouchEventNotification
+ object:self
+ userInfo:[self notificationUserInfo]];
+
+ UITouch *touch = event.allTouches.anyObject;
+ CGPoint touchLocation = [touch locationInView:self];
+
+ if(CGRectContainsPoint(self.hudView.frame, touchLocation)) {
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDDidTouchDownInsideNotification
+ object:self
+ userInfo:[self notificationUserInfo]];
+ }
+}
+
+
+#pragma mark - Master show/dismiss methods
+
+- (void)showProgress:(float)progress status:(NSString*)status {
+ __weak SVProgressHUD *weakSelf = self;
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
+ __strong SVProgressHUD *strongSelf = weakSelf;
+ if(strongSelf){
+ if(strongSelf.fadeOutTimer) {
+ strongSelf.activityCount = 0;
+ }
+
+ // Stop timer
+ strongSelf.fadeOutTimer = nil;
+ strongSelf.graceTimer = nil;
+
+ // Update / Check view hierarchy to ensure the HUD is visible
+ [strongSelf updateViewHierarchy];
+
+ // Reset imageView and fadeout timer if an image is currently displayed
+ strongSelf.imageView.hidden = YES;
+ strongSelf.imageView.image = nil;
+
+ // Update text and set progress to the given value
+ strongSelf.statusLabel.hidden = status.length == 0;
+ strongSelf.statusLabel.text = status;
+ strongSelf.progress = progress;
+
+ // Choose the "right" indicator depending on the progress
+ if(progress >= 0) {
+ // Cancel the indefiniteAnimatedView, then show the ringLayer
+ [strongSelf cancelIndefiniteAnimatedViewAnimation];
+
+ // Add ring to HUD
+ if(!strongSelf.ringView.superview){
+ [strongSelf.hudView.contentView addSubview:strongSelf.ringView];
+ }
+ if(!strongSelf.backgroundRingView.superview){
+ [strongSelf.hudView.contentView addSubview:strongSelf.backgroundRingView];
+ }
+
+ // Set progress animated
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+ strongSelf.ringView.strokeEnd = progress;
+ [CATransaction commit];
+
+ // Update the activity count
+ if(progress == 0) {
+ strongSelf.activityCount++;
+ }
+ } else {
+ // Cancel the ringLayer animation, then show the indefiniteAnimatedView
+ [strongSelf cancelRingLayerAnimation];
+
+ // Add indefiniteAnimatedView to HUD
+ [strongSelf.hudView.contentView addSubview:strongSelf.indefiniteAnimatedView];
+ if([strongSelf.indefiniteAnimatedView respondsToSelector:@selector(startAnimating)]) {
+ [(id)strongSelf.indefiniteAnimatedView startAnimating];
+ }
+
+ // Update the activity count
+ strongSelf.activityCount++;
+ }
+
+ // Fade in delayed if a grace time is set
+ if (self.graceTimeInterval > 0.0 && self.backgroundView.alpha == 0.0f) {
+ strongSelf.graceTimer = [NSTimer timerWithTimeInterval:self.graceTimeInterval target:strongSelf selector:@selector(fadeIn:) userInfo:nil repeats:NO];
+ [[NSRunLoop mainRunLoop] addTimer:strongSelf.graceTimer forMode:NSRunLoopCommonModes];
+ } else {
+ [strongSelf fadeIn:nil];
+ }
+
+ // Tell the Haptics Generator to prepare for feedback, which may come soon
+#if TARGET_OS_IOS
+ [strongSelf.hapticGenerator prepare];
+#endif
+ }
+ }];
+}
+
+- (void)showImage:(UIImage*)image status:(NSString*)status duration:(NSTimeInterval)duration {
+ __weak SVProgressHUD *weakSelf = self;
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
+ __strong SVProgressHUD *strongSelf = weakSelf;
+ if(strongSelf){
+ // Stop timer
+ strongSelf.fadeOutTimer = nil;
+ strongSelf.graceTimer = nil;
+
+ // Update / Check view hierarchy to ensure the HUD is visible
+ [strongSelf updateViewHierarchy];
+
+ // Reset progress and cancel any running animation
+ strongSelf.progress = SVProgressHUDUndefinedProgress;
+ [strongSelf cancelRingLayerAnimation];
+ [strongSelf cancelIndefiniteAnimatedViewAnimation];
+
+ // Update imageView
+ if (self.shouldTintImages) {
+ if (image.renderingMode != UIImageRenderingModeAlwaysTemplate) {
+ strongSelf.imageView.image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
+ } else {
+ strongSelf.imageView.image = image;
+ }
+ strongSelf.imageView.tintColor = strongSelf.foregroundImageColorForStyle;
+ } else {
+ strongSelf.imageView.image = image;
+ }
+ strongSelf.imageView.hidden = NO;
+
+ // Update text
+ strongSelf.statusLabel.hidden = status.length == 0;
+ strongSelf.statusLabel.text = status;
+
+ // Fade in delayed if a grace time is set
+ // An image will be dismissed automatically. Thus pass the duration as userInfo.
+ if (self.graceTimeInterval > 0.0 && self.backgroundView.alpha == 0.0f) {
+ strongSelf.graceTimer = [NSTimer timerWithTimeInterval:self.graceTimeInterval target:strongSelf selector:@selector(fadeIn:) userInfo:@(duration) repeats:NO];
+ [[NSRunLoop mainRunLoop] addTimer:strongSelf.graceTimer forMode:NSRunLoopCommonModes];
+ } else {
+ [strongSelf fadeIn:@(duration)];
+ }
+ }
+ }];
+}
+
+- (void)fadeIn:(id)data {
+ // Update the HUDs frame to the new content and position HUD
+ [self updateHUDFrame];
+ [self positionHUD:nil];
+
+ // Update accessibility as well as user interaction
+ // \n cause to read text twice so remove "\n" new line character before setting up accessiblity label
+ NSString *accessibilityString = [[self.statusLabel.text componentsSeparatedByCharactersInSet:[NSCharacterSet newlineCharacterSet]] componentsJoinedByString:@" "];
+ if(self.defaultMaskType != SVProgressHUDMaskTypeNone) {
+ self.controlView.userInteractionEnabled = YES;
+ self.accessibilityLabel = accessibilityString ?: NSLocalizedString(@"Loading", nil);
+ self.isAccessibilityElement = YES;
+ self.controlView.accessibilityViewIsModal = YES;
+ } else {
+ self.controlView.userInteractionEnabled = NO;
+ self.hudView.accessibilityLabel = accessibilityString ?: NSLocalizedString(@"Loading", nil);
+ self.isAccessibilityElement = NO;
+ self.hudView.isAccessibilityElement = YES;
+ self.controlView.accessibilityViewIsModal = NO;
+ }
+
+ // Get duration
+ id duration = [data isKindOfClass:[NSTimer class]] ? ((NSTimer *)data).userInfo : data;
+
+ // Show if not already visible
+ if(self.backgroundView.alpha != 1.0f) {
+ // Post notification to inform user
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDWillAppearNotification
+ object:self
+ userInfo:[self notificationUserInfo]];
+
+ // Zoom HUD a little to to make a nice appear / pop up animation
+ self.hudView.transform = self.hudView.transform = CGAffineTransformScale(self.hudView.transform, 1.3f, 1.3f);
+
+ __block void (^animationsBlock)(void) = ^{
+ // Zoom HUD a little to make a nice appear / pop up animation
+ self.hudView.transform = CGAffineTransformIdentity;
+
+ // Fade in all effects (colors, blur, etc.)
+ [self fadeInEffects];
+ };
+
+ __block void (^completionBlock)(void) = ^{
+ // Check if we really achieved to show the HUD (<=> alpha)
+ // and the change of these values has not been cancelled in between e.g. due to a dismissal
+ if(self.backgroundView.alpha == 1.0f){
+ // Register observer <=> we now have to handle orientation changes etc.
+ [self registerNotifications];
+
+ // Post notification to inform user
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDDidAppearNotification
+ object:self
+ userInfo:[self notificationUserInfo]];
+
+ // Update accessibility
+ UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
+ UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, self.statusLabel.text);
+
+ // Dismiss automatically if a duration was passed as userInfo. We start a timer
+ // which then will call dismiss after the predefined duration
+ if(duration){
+ self.fadeOutTimer = [NSTimer timerWithTimeInterval:[(NSNumber *)duration doubleValue] target:self selector:@selector(dismiss) userInfo:nil repeats:NO];
+ [[NSRunLoop mainRunLoop] addTimer:self.fadeOutTimer forMode:NSRunLoopCommonModes];
+ }
+ }
+ };
+
+ // Animate appearance
+ if (self.fadeInAnimationDuration > 0) {
+ // Animate appearance
+ [UIView animateWithDuration:self.fadeInAnimationDuration
+ delay:0
+ options:(UIViewAnimationOptions) (UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseIn | UIViewAnimationOptionBeginFromCurrentState)
+ animations:^{
+ animationsBlock();
+ } completion:^(BOOL finished) {
+ completionBlock();
+ }];
+ } else {
+ animationsBlock();
+ completionBlock();
+ }
+
+ // Inform iOS to redraw the view hierarchy
+ [self setNeedsDisplay];
+ } else {
+ // Update accessibility
+ UIAccessibilityPostNotification(UIAccessibilityScreenChangedNotification, nil);
+ UIAccessibilityPostNotification(UIAccessibilityAnnouncementNotification, self.statusLabel.text);
+
+ // Dismiss automatically if a duration was passed as userInfo. We start a timer
+ // which then will call dismiss after the predefined duration
+ if(duration){
+ self.fadeOutTimer = [NSTimer timerWithTimeInterval:[(NSNumber *)duration doubleValue] target:self selector:@selector(dismiss) userInfo:nil repeats:NO];
+ [[NSRunLoop mainRunLoop] addTimer:self.fadeOutTimer forMode:NSRunLoopCommonModes];
+ }
+ }
+}
+
+- (void)dismiss {
+ [self dismissWithDelay:0.0 completion:nil];
+}
+
+- (void)dismissWithDelay:(NSTimeInterval)delay completion:(SVProgressHUDDismissCompletion)completion {
+ __weak SVProgressHUD *weakSelf = self;
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
+ __strong SVProgressHUD *strongSelf = weakSelf;
+ if(strongSelf){
+
+ // Post notification to inform user
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDWillDisappearNotification
+ object:nil
+ userInfo:[strongSelf notificationUserInfo]];
+
+ // Reset activity count
+ strongSelf.activityCount = 0;
+
+ __block void (^animationsBlock)(void) = ^{
+ // Shrink HUD a little to make a nice disappear animation
+ strongSelf.hudView.transform = CGAffineTransformScale(strongSelf.hudView.transform, 1/1.3f, 1/1.3f);
+
+ // Fade out all effects (colors, blur, etc.)
+ [strongSelf fadeOutEffects];
+ };
+
+ __block void (^completionBlock)(void) = ^{
+ // Check if we really achieved to dismiss the HUD (<=> alpha values are applied)
+ // and the change of these values has not been cancelled in between e.g. due to a new show
+ if(self.backgroundView.alpha == 0.0f){
+ // Clean up view hierarchy (overlays)
+ [strongSelf.controlView removeFromSuperview];
+ [strongSelf.backgroundView removeFromSuperview];
+ [strongSelf.hudView removeFromSuperview];
+ [strongSelf removeFromSuperview];
+
+ // Reset progress and cancel any running animation
+ strongSelf.progress = SVProgressHUDUndefinedProgress;
+ [strongSelf cancelRingLayerAnimation];
+ [strongSelf cancelIndefiniteAnimatedViewAnimation];
+
+ // Remove observer <=> we do not have to handle orientation changes etc.
+ [[NSNotificationCenter defaultCenter] removeObserver:strongSelf];
+
+ // Post notification to inform user
+ [[NSNotificationCenter defaultCenter] postNotificationName:SVProgressHUDDidDisappearNotification
+ object:strongSelf
+ userInfo:[strongSelf notificationUserInfo]];
+
+ // Tell the rootViewController to update the StatusBar appearance
+#if !defined(SV_APP_EXTENSIONS) && TARGET_OS_IOS
+ UIViewController *rootController = [SVProgressHUD mainWindow].rootViewController;
+ [rootController setNeedsStatusBarAppearanceUpdate];
+#endif
+
+ // Run an (optional) completionHandler
+ if (completion) {
+ completion();
+ }
+ }
+ };
+
+ // UIViewAnimationOptionBeginFromCurrentState AND a delay doesn't always work as expected
+ // When UIViewAnimationOptionBeginFromCurrentState is set, animateWithDuration: evaluates the current
+ // values to check if an animation is necessary. The evaluation happens at function call time and not
+ // after the delay => the animation is sometimes skipped. Therefore we delay using dispatch_after.
+
+ dispatch_time_t dipatchTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delay * NSEC_PER_SEC));
+ dispatch_after(dipatchTime, dispatch_get_main_queue(), ^{
+
+ // Stop timer
+ strongSelf.graceTimer = nil;
+
+ if (strongSelf.fadeOutAnimationDuration > 0) {
+ // Animate appearance
+ [UIView animateWithDuration:strongSelf.fadeOutAnimationDuration
+ delay:0
+ options:(UIViewAnimationOptions) (UIViewAnimationOptionAllowUserInteraction | UIViewAnimationCurveEaseOut | UIViewAnimationOptionBeginFromCurrentState)
+ animations:^{
+ animationsBlock();
+ } completion:^(BOOL finished) {
+ completionBlock();
+ }];
+ } else {
+ animationsBlock();
+ completionBlock();
+ }
+ });
+
+ // Inform iOS to redraw the view hierarchy
+ [strongSelf setNeedsDisplay];
+ }
+ }];
+}
+
+
+#pragma mark - Ring progress animation
+
+- (UIView*)indefiniteAnimatedView {
+ // Get the correct spinner for defaultAnimationType
+ if(self.defaultAnimationType == SVProgressHUDAnimationTypeFlat){
+ // Check if spinner exists and is an object of different class
+ if(_indefiniteAnimatedView && ![_indefiniteAnimatedView isKindOfClass:[SVIndefiniteAnimatedView class]]){
+ [_indefiniteAnimatedView removeFromSuperview];
+ _indefiniteAnimatedView = nil;
+ }
+
+ if(!_indefiniteAnimatedView){
+ _indefiniteAnimatedView = [[SVIndefiniteAnimatedView alloc] initWithFrame:CGRectZero];
+ }
+
+ // Update styling
+ SVIndefiniteAnimatedView *indefiniteAnimatedView = (SVIndefiniteAnimatedView*)_indefiniteAnimatedView;
+ indefiniteAnimatedView.strokeColor = self.foregroundImageColorForStyle;
+ indefiniteAnimatedView.strokeThickness = self.ringThickness;
+ indefiniteAnimatedView.radius = self.statusLabel.text ? self.ringRadius : self.ringNoTextRadius;
+ } else {
+ // Check if spinner exists and is an object of different class
+ if(_indefiniteAnimatedView && ![_indefiniteAnimatedView isKindOfClass:[UIActivityIndicatorView class]]){
+ [_indefiniteAnimatedView removeFromSuperview];
+ _indefiniteAnimatedView = nil;
+ }
+
+ if(!_indefiniteAnimatedView){
+ _indefiniteAnimatedView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
+ }
+
+ // Update styling
+ UIActivityIndicatorView *activityIndicatorView = (UIActivityIndicatorView*)_indefiniteAnimatedView;
+ activityIndicatorView.color = self.foregroundImageColorForStyle;
+ }
+ [_indefiniteAnimatedView sizeToFit];
+
+ return _indefiniteAnimatedView;
+}
+
+- (SVProgressAnimatedView*)ringView {
+ if(!_ringView) {
+ _ringView = [[SVProgressAnimatedView alloc] initWithFrame:CGRectZero];
+ }
+
+ // Update styling
+ _ringView.strokeColor = self.foregroundImageColorForStyle;
+ _ringView.strokeThickness = self.ringThickness;
+ _ringView.radius = self.statusLabel.text ? self.ringRadius : self.ringNoTextRadius;
+
+ return _ringView;
+}
+
+- (SVProgressAnimatedView*)backgroundRingView {
+ if(!_backgroundRingView) {
+ _backgroundRingView = [[SVProgressAnimatedView alloc] initWithFrame:CGRectZero];
+ _backgroundRingView.strokeEnd = 1.0f;
+ }
+
+ // Update styling
+ _backgroundRingView.strokeColor = [self.foregroundImageColorForStyle colorWithAlphaComponent:0.1f];
+ _backgroundRingView.strokeThickness = self.ringThickness;
+ _backgroundRingView.radius = self.statusLabel.text ? self.ringRadius : self.ringNoTextRadius;
+
+ return _backgroundRingView;
+}
+
+- (void)cancelRingLayerAnimation {
+ // Animate value update, stop animation
+ [CATransaction begin];
+ [CATransaction setDisableActions:YES];
+
+ [self.hudView.layer removeAllAnimations];
+ self.ringView.strokeEnd = 0.0f;
+
+ [CATransaction commit];
+
+ // Remove from view
+ [self.ringView removeFromSuperview];
+ [self.backgroundRingView removeFromSuperview];
+}
+
+- (void)cancelIndefiniteAnimatedViewAnimation {
+ // Stop animation
+ if([self.indefiniteAnimatedView respondsToSelector:@selector(stopAnimating)]) {
+ [(id)self.indefiniteAnimatedView stopAnimating];
+ }
+ // Remove from view
+ [self.indefiniteAnimatedView removeFromSuperview];
+}
+
+
+#pragma mark - Utilities
+
++ (BOOL)isVisible {
+ // Checking one alpha value is sufficient as they are all the same
+ return [self sharedView].backgroundView.alpha > 0.0f;
+}
+
+
+#pragma mark - Getters
+
++ (NSTimeInterval)displayDurationForString:(NSString*)string {
+ CGFloat minimum = MAX((CGFloat)string.length * 0.06 + 0.5, [self sharedView].minimumDismissTimeInterval);
+ return MIN(minimum, [self sharedView].maximumDismissTimeInterval);
+}
+
+- (UIColor*)foregroundColorForStyle {
+ SVProgressHUDStyle style = [self defaultStyleResolvingAutomatic];
+
+ if(style == SVProgressHUDStyleLight) {
+ return [UIColor blackColor];
+ } else if(style == SVProgressHUDStyleDark) {
+ return [UIColor whiteColor];
+ } else {
+ return self.foregroundColor;
+ }
+}
+
+- (UIColor*)foregroundImageColorForStyle {
+ if (self.foregroundImageColor) {
+ return self.foregroundImageColor;
+ } else {
+ return [self foregroundColorForStyle];
+ }
+}
+
+- (UIColor*)backgroundColorForStyle {
+ SVProgressHUDStyle style = [self defaultStyleResolvingAutomatic];
+
+ if(style == SVProgressHUDStyleLight) {
+ return [UIColor whiteColor];
+ } else if(style == SVProgressHUDStyleDark) {
+ return [UIColor blackColor];
+ } else {
+ return self.backgroundColor;
+ }
+}
+
+- (UIControl*)controlView {
+ if(!_controlView) {
+ _controlView = [UIControl new];
+ _controlView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ _controlView.backgroundColor = [UIColor clearColor];
+ _controlView.userInteractionEnabled = YES;
+ [_controlView addTarget:self action:@selector(controlViewDidReceiveTouchEvent:forEvent:) forControlEvents:UIControlEventTouchDown];
+ }
+
+ // Update frame
+#if !defined(SV_APP_EXTENSIONS)
+ _controlView.frame = [SVProgressHUD mainWindow].bounds;
+#else
+ _controlView.frame = [UIScreen mainScreen].bounds;
+#endif
+
+ return _controlView;
+}
+
+-(UIView *)backgroundView {
+ if(!_backgroundView){
+ _backgroundView = [UIView new];
+ _backgroundView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
+ }
+ if(!_backgroundView.superview){
+ [self insertSubview:_backgroundView belowSubview:self.hudView];
+ }
+
+ // Update styling
+ if(self.defaultMaskType == SVProgressHUDMaskTypeGradient){
+ if(!_backgroundRadialGradientLayer){
+ _backgroundRadialGradientLayer = [SVRadialGradientLayer layer];
+ }
+ if(!_backgroundRadialGradientLayer.superlayer){
+ [_backgroundView.layer insertSublayer:_backgroundRadialGradientLayer atIndex:0];
+ }
+ _backgroundView.backgroundColor = [UIColor clearColor];
+ } else {
+ if(_backgroundRadialGradientLayer && _backgroundRadialGradientLayer.superlayer){
+ [_backgroundRadialGradientLayer removeFromSuperlayer];
+ }
+ if(self.defaultMaskType == SVProgressHUDMaskTypeBlack){
+ _backgroundView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
+ } else if(self.defaultMaskType == SVProgressHUDMaskTypeCustom){
+ _backgroundView.backgroundColor = self.backgroundLayerColor;
+ } else {
+ _backgroundView.backgroundColor = [UIColor clearColor];
+ }
+ }
+
+ // Update frame
+ if(_backgroundView){
+ _backgroundView.frame = self.bounds;
+ }
+ if(_backgroundRadialGradientLayer){
+ _backgroundRadialGradientLayer.frame = self.bounds;
+
+ // Calculate the new center of the gradient, it may change if keyboard is visible
+ CGPoint gradientCenter = self.center;
+ gradientCenter.y = (self.bounds.size.height - self.visibleKeyboardHeight)/2;
+ _backgroundRadialGradientLayer.gradientCenter = gradientCenter;
+ [_backgroundRadialGradientLayer setNeedsDisplay];
+ }
+
+ return _backgroundView;
+}
+- (UIVisualEffectView*)hudView {
+ if(!_hudView) {
+ _hudView = [UIVisualEffectView new];
+ _hudView.layer.masksToBounds = YES;
+ _hudView.autoresizingMask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleLeftMargin;
+ }
+ if(!_hudView.superview) {
+ [self addSubview:_hudView];
+ }
+
+ // Update styling
+ _hudView.layer.cornerRadius = self.cornerRadius;
+
+ return _hudView;
+}
+
+- (UILabel*)statusLabel {
+ if(!_statusLabel) {
+ _statusLabel = [[UILabel alloc] initWithFrame:CGRectZero];
+ _statusLabel.backgroundColor = [UIColor clearColor];
+ _statusLabel.adjustsFontSizeToFitWidth = YES;
+ _statusLabel.adjustsFontForContentSizeCategory = YES;
+ _statusLabel.textAlignment = NSTextAlignmentCenter;
+ _statusLabel.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
+ _statusLabel.numberOfLines = 0;
+ }
+ if(!_statusLabel.superview) {
+ [self.hudView.contentView addSubview:_statusLabel];
+ }
+
+ // Update styling
+ _statusLabel.textColor = self.foregroundColorForStyle;
+ _statusLabel.font = self.font;
+
+ return _statusLabel;
+}
+
+- (UIImageView*)imageView {
+ if(_imageView && !CGSizeEqualToSize(_imageView.bounds.size, _imageViewSize)) {
+ [_imageView removeFromSuperview];
+ _imageView = nil;
+ }
+
+ if(!_imageView) {
+ _imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, _imageViewSize.width, _imageViewSize.height)];
+ }
+ if(!_imageView.superview) {
+ [self.hudView.contentView addSubview:_imageView];
+ }
+
+ return _imageView;
+}
+
+
+#pragma mark - Helper
+
+- (SVProgressHUDStyle) defaultStyleResolvingAutomatic {
+ if(self.defaultStyle == SVProgressHUDStyleAutomatic) {
+ return self.traitCollection.userInterfaceStyle == UIUserInterfaceStyleDark ? SVProgressHUDStyleDark : SVProgressHUDStyleLight;
+ }
+
+ return self.defaultStyle;
+}
+
+- (CGFloat)visibleKeyboardHeight {
+#if !defined(SV_APP_EXTENSIONS)
+ UIWindow *keyboardWindow = nil;
+ for (UIWindow *testWindow in UIApplication.sharedApplication.windows) {
+ if(![testWindow.class isEqual:UIWindow.class]) {
+ keyboardWindow = testWindow;
+ break;
+ }
+ }
+
+ for (__strong UIView *possibleKeyboard in keyboardWindow.subviews) {
+ NSString *viewName = NSStringFromClass(possibleKeyboard.class);
+ if([viewName hasPrefix:@"UI"]){
+ if([viewName hasSuffix:@"PeripheralHostView"] || [viewName hasSuffix:@"Keyboard"]){
+ return CGRectGetHeight(possibleKeyboard.bounds);
+ } else if ([viewName hasSuffix:@"InputSetContainerView"]){
+ for (__strong UIView *possibleKeyboardSubview in possibleKeyboard.subviews) {
+ viewName = NSStringFromClass(possibleKeyboardSubview.class);
+ if([viewName hasPrefix:@"UI"] && [viewName hasSuffix:@"InputSetHostView"]) {
+ CGRect convertedRect = [possibleKeyboard convertRect:possibleKeyboardSubview.frame toView:self];
+ CGRect intersectedRect = CGRectIntersection(convertedRect, self.bounds);
+ if (!CGRectIsNull(intersectedRect)) {
+ return CGRectGetHeight(intersectedRect);
+ }
+ }
+ }
+ }
+ }
+ }
+#endif
+ return 0;
+}
+
+- (UIWindow *)frontWindow {
+#if !defined(SV_APP_EXTENSIONS)
+ NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator];
+ for (UIWindow *window in frontToBackWindows) {
+ BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen;
+ BOOL windowIsVisible = !window.hidden && window.alpha > 0;
+ BOOL windowLevelSupported = (window.windowLevel >= UIWindowLevelNormal && window.windowLevel <= self.maxSupportedWindowLevel);
+ BOOL windowKeyWindow = window.isKeyWindow;
+
+ if(windowOnMainScreen && windowIsVisible && windowLevelSupported && windowKeyWindow) {
+ return window;
+ }
+ }
+#endif
+ return nil;
+}
+
+- (void)fadeInEffects {
+ if(self.defaultStyle != SVProgressHUDStyleCustom) {
+ // Add blur effect
+ UIBlurEffectStyle blurEffectStyle;
+#if TARGET_OS_IOS
+ if (@available(iOS 13.0, *)) {
+ blurEffectStyle = [self defaultStyleResolvingAutomatic] == SVProgressHUDStyleLight ? UIBlurEffectStyleSystemMaterial : UIBlurEffectStyleSystemMaterialDark;
+ } else {
+ blurEffectStyle = [self defaultStyleResolvingAutomatic] == SVProgressHUDStyleLight ? UIBlurEffectStyleLight : UIBlurEffectStyleDark;
+ }
+#else
+ blurEffectStyle = [self defaultStyleResolvingAutomatic] == SVProgressHUDStyleLight ? UIBlurEffectStyleLight : UIBlurEffectStyleDark;
+#endif
+
+ UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:blurEffectStyle];
+ self.hudView.effect = blurEffect;
+
+ // We omit UIVibrancy effect and use a suitable background color as an alternative.
+ // This will make everything more readable. See the following for details:
+ // https://www.omnigroup.com/developer/how-to-make-text-in-a-uivisualeffectview-readable-on-any-background
+
+ self.hudView.backgroundColor = [self.backgroundColorForStyle colorWithAlphaComponent:0.6f];
+ } else {
+ self.hudView.effect = self.hudViewCustomBlurEffect;
+ self.hudView.backgroundColor = self.backgroundColorForStyle;
+ }
+
+ // Fade in views
+ self.backgroundView.alpha = 1.0f;
+
+ self.imageView.alpha = 1.0f;
+ self.statusLabel.alpha = 1.0f;
+ self.indefiniteAnimatedView.alpha = 1.0f;
+ self.ringView.alpha = self.backgroundRingView.alpha = 1.0f;
+}
+
+- (void)fadeOutEffects
+{
+ if(self.defaultStyle != SVProgressHUDStyleCustom) {
+ // Remove blur effect
+ self.hudView.effect = nil;
+ }
+
+ // Remove background color
+ self.hudView.backgroundColor = [UIColor clearColor];
+
+ // Fade out views
+ self.backgroundView.alpha = 0.0f;
+
+ self.imageView.alpha = 0.0f;
+ self.statusLabel.alpha = 0.0f;
+ self.indefiniteAnimatedView.alpha = 0.0f;
+ self.ringView.alpha = self.backgroundRingView.alpha = 0.0f;
+}
+
+#if TARGET_OS_IOS
+- (UINotificationFeedbackGenerator *)hapticGenerator {
+ // Only return if haptics are enabled
+ if(!self.hapticsEnabled) {
+ return nil;
+ }
+
+ if(!_hapticGenerator) {
+ _hapticGenerator = [[UINotificationFeedbackGenerator alloc] init];
+ }
+ return _hapticGenerator;
+}
+#endif
+
+
+#pragma mark - UIAppearance Setters
+
+- (void)setDefaultStyle:(SVProgressHUDStyle)style {
+ if (!_isInitializing) _defaultStyle = style;
+}
+
+- (void)setDefaultMaskType:(SVProgressHUDMaskType)maskType {
+ if (!_isInitializing) _defaultMaskType = maskType;
+}
+
+- (void)setDefaultAnimationType:(SVProgressHUDAnimationType)animationType {
+ if (!_isInitializing) _defaultAnimationType = animationType;
+}
+
+- (void)setContainerView:(UIView *)containerView {
+ if (!_isInitializing) _containerView = containerView;
+}
+
+- (void)setMinimumSize:(CGSize)minimumSize {
+ if (!_isInitializing) _minimumSize = minimumSize;
+}
+
+- (void)setRingThickness:(CGFloat)ringThickness {
+ if (!_isInitializing) _ringThickness = ringThickness;
+}
+
+- (void)setRingRadius:(CGFloat)ringRadius {
+ if (!_isInitializing) _ringRadius = ringRadius;
+}
+
+- (void)setRingNoTextRadius:(CGFloat)ringNoTextRadius {
+ if (!_isInitializing) _ringNoTextRadius = ringNoTextRadius;
+}
+
+- (void)setCornerRadius:(CGFloat)cornerRadius {
+ if (!_isInitializing) _cornerRadius = cornerRadius;
+}
+
+- (void)setFont:(UIFont*)font {
+ if (!_isInitializing) _font = font;
+}
+
+- (void)setForegroundColor:(UIColor*)color {
+ if (!_isInitializing) _foregroundColor = color;
+}
+
+- (void)setForegroundImageColor:(UIColor *)color {
+ if (!_isInitializing) _foregroundImageColor = color;
+}
+
+- (void)setBackgroundColor:(UIColor*)color {
+ if (!_isInitializing) _backgroundColor = color;
+}
+
+- (void)setBackgroundLayerColor:(UIColor*)color {
+ if (!_isInitializing) _backgroundLayerColor = color;
+}
+
+- (void)setShouldTintImages:(BOOL)shouldTintImages {
+ if (!_isInitializing) _shouldTintImages = shouldTintImages;
+}
+
+- (void)setInfoImage:(UIImage*)image {
+ if (!_isInitializing) _infoImage = image;
+}
+
+- (void)setSuccessImage:(UIImage*)image {
+ if (!_isInitializing) _successImage = image;
+}
+
+- (void)setErrorImage:(UIImage*)image {
+ if (!_isInitializing) _errorImage = image;
+}
+
+- (void)setViewForExtension:(UIView*)view {
+ if (!_isInitializing) _viewForExtension = view;
+}
+
+- (void)setOffsetFromCenter:(UIOffset)offset {
+ if (!_isInitializing) _offsetFromCenter = offset;
+}
+
+- (void)setMinimumDismissTimeInterval:(NSTimeInterval)minimumDismissTimeInterval {
+ if (!_isInitializing) _minimumDismissTimeInterval = minimumDismissTimeInterval;
+}
+
+- (void)setFadeInAnimationDuration:(NSTimeInterval)duration {
+ if (!_isInitializing) _fadeInAnimationDuration = duration;
+}
+
+- (void)setFadeOutAnimationDuration:(NSTimeInterval)duration {
+ if (!_isInitializing) _fadeOutAnimationDuration = duration;
+}
+
+- (void)setMaxSupportedWindowLevel:(UIWindowLevel)maxSupportedWindowLevel {
+ if (!_isInitializing) _maxSupportedWindowLevel = maxSupportedWindowLevel;
+}
+
+@end
--- /dev/null
+//
+// SVRadialGradientLayer.h
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2014-2023 Tobias Totzek and contributors. All rights reserved.
+//
+
+#import <QuartzCore/QuartzCore.h>
+
+@interface SVRadialGradientLayer : CALayer
+
+@property (nonatomic) CGPoint gradientCenter;
+
+@end
--- /dev/null
+//
+// SVRadialGradientLayer.m
+// SVProgressHUD, https://github.com/SVProgressHUD/SVProgressHUD
+//
+// Copyright (c) 2014-2023 Tobias Totzek and contributors. All rights reserved.
+//
+
+#import "SVRadialGradientLayer.h"
+
+@implementation SVRadialGradientLayer
+
+- (void)drawInContext:(CGContextRef)context {
+ size_t locationsCount = 2;
+ CGFloat locations[2] = {0.0f, 1.0f};
+ CGFloat colors[8] = {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.75f};
+ CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
+ CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, colors, locations, locationsCount);
+ CGColorSpaceRelease(colorSpace);
+
+ float radius = MIN(self.bounds.size.width , self.bounds.size.height);
+ CGContextDrawRadialGradient (context, gradient, self.gradientCenter, 0, self.gradientCenter, radius, kCGGradientDrawsAfterEndLocation);
+ CGGradientRelease(gradient);
+}
+
+@end
--- /dev/null
+Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null
+<img src="https://snapkit.github.io/SnapKit/images/banner.jpg" alt="" />
+
+SnapKit is a DSL to make Auto Layout easy on both iOS and OS X.
+
+[](https://travis-ci.org/SnapKit/SnapKit)
+[](https://github.com/SnapKit/SnapKit)
+[](https://cocoapods.org/pods/SnapKit)
+[](https://github.com/Carthage/Carthage)
+
+#### ⚠️ **To use with Swift 4.x please ensure you are using >= 4.0.0** ⚠️
+#### ⚠️ **To use with Swift 5.x please ensure you are using >= 5.0.0** ⚠️
+
+## Contents
+
+- [Requirements](#requirements)
+- [Migration Guides](#migration-guides)
+- [Communication](#communication)
+- [Installation](#installation)
+- [Usage](#usage)
+- [Credits](#credits)
+- [License](#license)
+
+## Requirements
+
+- iOS 12.0+ / Mac OS X 10.13+ / tvOS 10.0+
+- Xcode 10.0+
+- Swift 4.0+
+
+## Migration Guides
+
+- [SnapKit 3.0 Migration Guide](Documentation/SnapKit%203.0%20Migration%20Guide.md)
+
+## Communication
+
+- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit). (Tag 'snapkit')
+- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/snapkit).
+- If you **found a bug**, open an issue.
+- If you **have a feature request**, open an issue.
+- If you **want to contribute**, submit a pull request.
+
+
+## Installation
+
+### CocoaPods
+
+[CocoaPods](http://cocoapods.org) is a dependency manager for Cocoa projects. You can install it with the following command:
+
+```bash
+$ gem install cocoapods
+```
+
+> CocoaPods 1.1.0+ is required to build SnapKit 4.0.0+.
+
+To integrate SnapKit into your Xcode project using CocoaPods, specify it in your `Podfile`:
+
+```ruby
+source 'https://github.com/CocoaPods/Specs.git'
+platform :ios, '10.0'
+use_frameworks!
+
+target '<Your Target Name>' do
+ pod 'SnapKit', '~> 5.7.0'
+end
+```
+
+Then, run the following command:
+
+```bash
+$ pod install
+```
+
+### Carthage
+
+[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.
+
+You can install Carthage with [Homebrew](http://brew.sh/) using the following command:
+
+```bash
+$ brew update
+$ brew install carthage
+```
+
+To integrate SnapKit into your Xcode project using Carthage, specify it in your `Cartfile`:
+
+```ogdl
+github "SnapKit/SnapKit" ~> 5.0.0
+```
+
+Run `carthage update` to build the framework and drag the built `SnapKit.framework` into your Xcode project.
+
+### Swift Package Manager
+
+[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.
+
+> Xcode 11+ is required to build SnapKit using Swift Package Manager.
+
+To integrate SnapKit into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:
+
+```swift
+dependencies: [
+ .package(url: "https://github.com/SnapKit/SnapKit.git", .upToNextMajor(from: "5.0.1"))
+]
+```
+
+### Manually
+
+If you prefer not to use either of the aforementioned dependency managers, you can integrate SnapKit into your project manually.
+
+---
+
+## Usage
+
+### Quick Start
+
+```swift
+import SnapKit
+
+class MyViewController: UIViewController {
+
+ lazy var box = UIView()
+
+ override func viewDidLoad() {
+ super.viewDidLoad()
+
+ self.view.addSubview(box)
+ box.backgroundColor = .green
+ box.snp.makeConstraints { (make) -> Void in
+ make.width.height.equalTo(50)
+ make.center.equalTo(self.view)
+ }
+ }
+
+}
+```
+
+### Playground
+You can try SnapKit in Playground.
+
+**Note:**
+
+> To try SnapKit in playground, open `SnapKit.xcworkspace` and build SnapKit.framework for any simulator first.
+
+### Resources
+
+- [Documentation](https://snapkit.github.io/SnapKit/docs/)
+- [F.A.Q.](https://snapkit.github.io/SnapKit/faq/)
+
+## Credits
+
+- Robert Payne ([@robertjpayne](https://twitter.com/robertjpayne))
+- Many other contributors
+
+## License
+
+SnapKit is released under the MIT license. See LICENSE for details.
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+public final class Constraint {
+
+ internal let sourceLocation: (String, UInt)
+ internal let label: String?
+
+ private let from: ConstraintItem
+ private let to: ConstraintItem
+ private let relation: ConstraintRelation
+ private let multiplier: ConstraintMultiplierTarget
+ private var constant: ConstraintConstantTarget {
+ didSet {
+ self.updateConstantAndPriorityIfNeeded()
+ }
+ }
+ private var priority: ConstraintPriorityTarget {
+ didSet {
+ self.updateConstantAndPriorityIfNeeded()
+ }
+ }
+ public var layoutConstraints: [LayoutConstraint]
+
+ public var isActive: Bool {
+ set {
+ if newValue {
+ activate()
+ }
+ else {
+ deactivate()
+ }
+ }
+
+ get {
+ for layoutConstraint in self.layoutConstraints {
+ if layoutConstraint.isActive {
+ return true
+ }
+ }
+ return false
+ }
+ }
+
+ // MARK: Initialization
+
+ internal init(from: ConstraintItem,
+ to: ConstraintItem,
+ relation: ConstraintRelation,
+ sourceLocation: (String, UInt),
+ label: String?,
+ multiplier: ConstraintMultiplierTarget,
+ constant: ConstraintConstantTarget,
+ priority: ConstraintPriorityTarget) {
+ self.from = from
+ self.to = to
+ self.relation = relation
+ self.sourceLocation = sourceLocation
+ self.label = label
+ self.multiplier = multiplier
+ self.constant = constant
+ self.priority = priority
+ self.layoutConstraints = []
+
+ // get attributes
+ let layoutFromAttributes = self.from.attributes.layoutAttributes
+ let layoutToAttributes = self.to.attributes.layoutAttributes
+
+ // get layout from
+ let layoutFrom = self.from.layoutConstraintItem!
+
+ // get relation
+ let layoutRelation = self.relation.layoutRelation
+
+ for layoutFromAttribute in layoutFromAttributes {
+ // get layout to attribute
+ let layoutToAttribute: LayoutAttribute
+ #if canImport(UIKit)
+ if layoutToAttributes.count > 0 {
+ if self.from.attributes == .edges && self.to.attributes == .margins {
+ switch layoutFromAttribute {
+ case .left:
+ layoutToAttribute = .leftMargin
+ case .right:
+ layoutToAttribute = .rightMargin
+ case .top:
+ layoutToAttribute = .topMargin
+ case .bottom:
+ layoutToAttribute = .bottomMargin
+ default:
+ fatalError()
+ }
+ } else if self.from.attributes == .margins && self.to.attributes == .edges {
+ switch layoutFromAttribute {
+ case .leftMargin:
+ layoutToAttribute = .left
+ case .rightMargin:
+ layoutToAttribute = .right
+ case .topMargin:
+ layoutToAttribute = .top
+ case .bottomMargin:
+ layoutToAttribute = .bottom
+ default:
+ fatalError()
+ }
+ } else if self.from.attributes == .directionalEdges && self.to.attributes == .directionalMargins {
+ switch layoutFromAttribute {
+ case .leading:
+ layoutToAttribute = .leadingMargin
+ case .trailing:
+ layoutToAttribute = .trailingMargin
+ case .top:
+ layoutToAttribute = .topMargin
+ case .bottom:
+ layoutToAttribute = .bottomMargin
+ default:
+ fatalError()
+ }
+ } else if self.from.attributes == .directionalMargins && self.to.attributes == .directionalEdges {
+ switch layoutFromAttribute {
+ case .leadingMargin:
+ layoutToAttribute = .leading
+ case .trailingMargin:
+ layoutToAttribute = .trailing
+ case .topMargin:
+ layoutToAttribute = .top
+ case .bottomMargin:
+ layoutToAttribute = .bottom
+ default:
+ fatalError()
+ }
+ } else if self.from.attributes == self.to.attributes {
+ layoutToAttribute = layoutFromAttribute
+ } else {
+ layoutToAttribute = layoutToAttributes[0]
+ }
+ } else {
+ if self.to.target == nil && (layoutFromAttribute == .centerX || layoutFromAttribute == .centerY) {
+ layoutToAttribute = layoutFromAttribute == .centerX ? .left : .top
+ } else {
+ layoutToAttribute = layoutFromAttribute
+ }
+ }
+ #else
+ if self.from.attributes == self.to.attributes {
+ layoutToAttribute = layoutFromAttribute
+ } else if layoutToAttributes.count > 0 {
+ layoutToAttribute = layoutToAttributes[0]
+ } else {
+ layoutToAttribute = layoutFromAttribute
+ }
+ #endif
+
+ // get layout constant
+ let layoutConstant: CGFloat = self.constant.constraintConstantTargetValueFor(layoutAttribute: layoutToAttribute)
+
+ // get layout to
+ var layoutTo: AnyObject? = self.to.target
+
+ // use superview if possible
+ if layoutTo == nil && layoutToAttribute != .width && layoutToAttribute != .height {
+ layoutTo = layoutFrom.superview
+ }
+
+ // create layout constraint
+ let layoutConstraint = LayoutConstraint(
+ item: layoutFrom,
+ attribute: layoutFromAttribute,
+ relatedBy: layoutRelation,
+ toItem: layoutTo,
+ attribute: layoutToAttribute,
+ multiplier: self.multiplier.constraintMultiplierTargetValue,
+ constant: layoutConstant
+ )
+
+ // set label
+ layoutConstraint.label = self.label
+
+ // set priority
+ layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
+
+ // set constraint
+ layoutConstraint.constraint = self
+
+ // append
+ self.layoutConstraints.append(layoutConstraint)
+ }
+ }
+
+ // MARK: Public
+
+ @available(*, deprecated, renamed:"activate()")
+ public func install() {
+ self.activate()
+ }
+
+ @available(*, deprecated, renamed:"deactivate()")
+ public func uninstall() {
+ self.deactivate()
+ }
+
+ public func activate() {
+ self.activateIfNeeded()
+ }
+
+ public func deactivate() {
+ self.deactivateIfNeeded()
+ }
+
+ @discardableResult
+ public func update(offset: ConstraintOffsetTarget) -> Constraint {
+ self.constant = offset.constraintOffsetTargetValue
+ return self
+ }
+
+ @discardableResult
+ public func update(inset: ConstraintInsetTarget) -> Constraint {
+ self.constant = inset.constraintInsetTargetValue
+ return self
+ }
+
+ #if canImport(UIKit)
+ @discardableResult
+ @available(iOS 11.0, tvOS 11.0, *)
+ public func update(inset: ConstraintDirectionalInsetTarget) -> Constraint {
+ self.constant = inset.constraintDirectionalInsetTargetValue
+ return self
+ }
+ #endif
+
+ @discardableResult
+ public func update(priority: ConstraintPriorityTarget) -> Constraint {
+ self.priority = priority.constraintPriorityTargetValue
+ return self
+ }
+
+ @discardableResult
+ public func update(priority: ConstraintPriority) -> Constraint {
+ self.priority = priority.value
+ return self
+ }
+
+ @available(*, deprecated, renamed:"update(offset:)")
+ public func updateOffset(amount: ConstraintOffsetTarget) -> Void { self.update(offset: amount) }
+
+ @available(*, deprecated, renamed:"update(inset:)")
+ public func updateInsets(amount: ConstraintInsetTarget) -> Void { self.update(inset: amount) }
+
+ @available(*, deprecated, renamed:"update(priority:)")
+ public func updatePriority(amount: ConstraintPriorityTarget) -> Void { self.update(priority: amount) }
+
+ @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
+ public func updatePriorityRequired() -> Void {}
+
+ @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
+ public func updatePriorityHigh() -> Void { fatalError("Must be implemented by Concrete subclass.") }
+
+ @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
+ public func updatePriorityMedium() -> Void { fatalError("Must be implemented by Concrete subclass.") }
+
+ @available(*, deprecated, message:"Use update(priority: ConstraintPriorityTarget) instead.")
+ public func updatePriorityLow() -> Void { fatalError("Must be implemented by Concrete subclass.") }
+
+ // MARK: Internal
+
+ internal func updateConstantAndPriorityIfNeeded() {
+ for layoutConstraint in self.layoutConstraints {
+ let attribute = (layoutConstraint.secondAttribute == .notAnAttribute) ? layoutConstraint.firstAttribute : layoutConstraint.secondAttribute
+ layoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: attribute)
+
+ let requiredPriority = ConstraintPriority.required.value
+ if (layoutConstraint.priority.rawValue < requiredPriority), (self.priority.constraintPriorityTargetValue != requiredPriority) {
+ layoutConstraint.priority = LayoutPriority(rawValue: self.priority.constraintPriorityTargetValue)
+ }
+ }
+ }
+
+ internal func activateIfNeeded(updatingExisting: Bool = false) {
+ guard let item = self.from.layoutConstraintItem else {
+ print("WARNING: SnapKit failed to get from item from constraint. Activate will be a no-op.")
+ return
+ }
+ let layoutConstraints = self.layoutConstraints
+
+ if updatingExisting {
+ var existingLayoutConstraints: [LayoutConstraint] = []
+ for constraint in item.constraints {
+ existingLayoutConstraints += constraint.layoutConstraints
+ }
+
+ for layoutConstraint in layoutConstraints {
+ let existingLayoutConstraint = existingLayoutConstraints.first { $0 == layoutConstraint }
+ guard let updateLayoutConstraint = existingLayoutConstraint else {
+ fatalError("Updated constraint could not find existing matching constraint to update: \(layoutConstraint)")
+ }
+
+ let updateLayoutAttribute = (updateLayoutConstraint.secondAttribute == .notAnAttribute) ? updateLayoutConstraint.firstAttribute : updateLayoutConstraint.secondAttribute
+ updateLayoutConstraint.constant = self.constant.constraintConstantTargetValueFor(layoutAttribute: updateLayoutAttribute)
+ }
+ } else {
+ NSLayoutConstraint.activate(layoutConstraints)
+ item.add(constraints: [self])
+ }
+ }
+
+ internal func deactivateIfNeeded() {
+ guard let item = self.from.layoutConstraintItem else {
+ print("WARNING: SnapKit failed to get from item from constraint. Deactivate will be a no-op.")
+ return
+ }
+ let layoutConstraints = self.layoutConstraints
+ NSLayoutConstraint.deactivate(layoutConstraints)
+ item.remove(constraints: [self])
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+internal struct ConstraintAttributes : OptionSet, ExpressibleByIntegerLiteral {
+
+ typealias IntegerLiteralType = UInt
+
+ internal init(rawValue: UInt) {
+ self.rawValue = rawValue
+ }
+ internal init(_ rawValue: UInt) {
+ self.init(rawValue: rawValue)
+ }
+ internal init(nilLiteral: ()) {
+ self.rawValue = 0
+ }
+ internal init(integerLiteral rawValue: IntegerLiteralType) {
+ self.init(rawValue: rawValue)
+ }
+
+ internal private(set) var rawValue: UInt
+ internal static var allZeros: ConstraintAttributes { return 0 }
+ internal static func convertFromNilLiteral() -> ConstraintAttributes { return 0 }
+ internal var boolValue: Bool { return self.rawValue != 0 }
+
+ internal func toRaw() -> UInt { return self.rawValue }
+ internal static func fromRaw(_ raw: UInt) -> ConstraintAttributes? { return self.init(raw) }
+ internal static func fromMask(_ raw: UInt) -> ConstraintAttributes { return self.init(raw) }
+
+ // normal
+
+ internal static let none: ConstraintAttributes = 0
+ internal static let left: ConstraintAttributes = ConstraintAttributes(UInt(1) << 0)
+ internal static let top: ConstraintAttributes = ConstraintAttributes(UInt(1) << 1)
+ internal static let right: ConstraintAttributes = ConstraintAttributes(UInt(1) << 2)
+ internal static let bottom: ConstraintAttributes = ConstraintAttributes(UInt(1) << 3)
+ internal static let leading: ConstraintAttributes = ConstraintAttributes(UInt(1) << 4)
+ internal static let trailing: ConstraintAttributes = ConstraintAttributes(UInt(1) << 5)
+ internal static let width: ConstraintAttributes = ConstraintAttributes(UInt(1) << 6)
+ internal static let height: ConstraintAttributes = ConstraintAttributes(UInt(1) << 7)
+ internal static let centerX: ConstraintAttributes = ConstraintAttributes(UInt(1) << 8)
+ internal static let centerY: ConstraintAttributes = ConstraintAttributes(UInt(1) << 9)
+ internal static let lastBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 10)
+
+ @available(iOS 8.0, OSX 10.11, *)
+ internal static let firstBaseline: ConstraintAttributes = ConstraintAttributes(UInt(1) << 11)
+
+ @available(iOS 8.0, *)
+ internal static let leftMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 12)
+
+ @available(iOS 8.0, *)
+ internal static let rightMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 13)
+
+ @available(iOS 8.0, *)
+ internal static let topMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 14)
+
+ @available(iOS 8.0, *)
+ internal static let bottomMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 15)
+
+ @available(iOS 8.0, *)
+ internal static let leadingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 16)
+
+ @available(iOS 8.0, *)
+ internal static let trailingMargin: ConstraintAttributes = ConstraintAttributes(UInt(1) << 17)
+
+ @available(iOS 8.0, *)
+ internal static let centerXWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 18)
+
+ @available(iOS 8.0, *)
+ internal static let centerYWithinMargins: ConstraintAttributes = ConstraintAttributes(UInt(1) << 19)
+
+ // aggregates
+
+ internal static let edges: ConstraintAttributes = [.horizontalEdges, .verticalEdges]
+ internal static let horizontalEdges: ConstraintAttributes = [.left, .right]
+ internal static let verticalEdges: ConstraintAttributes = [.top, .bottom]
+ internal static let directionalEdges: ConstraintAttributes = [.directionalHorizontalEdges, .directionalVerticalEdges]
+ internal static let directionalHorizontalEdges: ConstraintAttributes = [.leading, .trailing]
+ internal static let directionalVerticalEdges: ConstraintAttributes = [.top, .bottom]
+ internal static let size: ConstraintAttributes = [.width, .height]
+ internal static let center: ConstraintAttributes = [.centerX, .centerY]
+
+ @available(iOS 8.0, *)
+ internal static let margins: ConstraintAttributes = [.leftMargin, .topMargin, .rightMargin, .bottomMargin]
+
+ @available(iOS 8.0, *)
+ internal static let directionalMargins: ConstraintAttributes = [.leadingMargin, .topMargin, .trailingMargin, .bottomMargin]
+
+ @available(iOS 8.0, *)
+ internal static let centerWithinMargins: ConstraintAttributes = [.centerXWithinMargins, .centerYWithinMargins]
+
+ internal var layoutAttributes:[LayoutAttribute] {
+ var attrs = [LayoutAttribute]()
+ if (self.contains(ConstraintAttributes.left)) {
+ attrs.append(.left)
+ }
+ if (self.contains(ConstraintAttributes.top)) {
+ attrs.append(.top)
+ }
+ if (self.contains(ConstraintAttributes.right)) {
+ attrs.append(.right)
+ }
+ if (self.contains(ConstraintAttributes.bottom)) {
+ attrs.append(.bottom)
+ }
+ if (self.contains(ConstraintAttributes.leading)) {
+ attrs.append(.leading)
+ }
+ if (self.contains(ConstraintAttributes.trailing)) {
+ attrs.append(.trailing)
+ }
+ if (self.contains(ConstraintAttributes.width)) {
+ attrs.append(.width)
+ }
+ if (self.contains(ConstraintAttributes.height)) {
+ attrs.append(.height)
+ }
+ if (self.contains(ConstraintAttributes.centerX)) {
+ attrs.append(.centerX)
+ }
+ if (self.contains(ConstraintAttributes.centerY)) {
+ attrs.append(.centerY)
+ }
+ if (self.contains(ConstraintAttributes.lastBaseline)) {
+ attrs.append(.lastBaseline)
+ }
+
+ #if canImport(UIKit)
+ if (self.contains(ConstraintAttributes.firstBaseline)) {
+ attrs.append(.firstBaseline)
+ }
+ if (self.contains(ConstraintAttributes.leftMargin)) {
+ attrs.append(.leftMargin)
+ }
+ if (self.contains(ConstraintAttributes.rightMargin)) {
+ attrs.append(.rightMargin)
+ }
+ if (self.contains(ConstraintAttributes.topMargin)) {
+ attrs.append(.topMargin)
+ }
+ if (self.contains(ConstraintAttributes.bottomMargin)) {
+ attrs.append(.bottomMargin)
+ }
+ if (self.contains(ConstraintAttributes.leadingMargin)) {
+ attrs.append(.leadingMargin)
+ }
+ if (self.contains(ConstraintAttributes.trailingMargin)) {
+ attrs.append(.trailingMargin)
+ }
+ if (self.contains(ConstraintAttributes.centerXWithinMargins)) {
+ attrs.append(.centerXWithinMargins)
+ }
+ if (self.contains(ConstraintAttributes.centerYWithinMargins)) {
+ attrs.append(.centerYWithinMargins)
+ }
+ #endif
+
+ return attrs
+ }
+}
+
+internal func + (left: ConstraintAttributes, right: ConstraintAttributes) -> ConstraintAttributes {
+ return left.union(right)
+}
+
+internal func +=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
+ left.formUnion(right)
+}
+
+internal func -=(left: inout ConstraintAttributes, right: ConstraintAttributes) {
+ left.subtract(right)
+}
+
+internal func ==(left: ConstraintAttributes, right: ConstraintAttributes) -> Bool {
+ return left.rawValue == right.rawValue
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+ public typealias ConstraintInterfaceLayoutDirection = UIUserInterfaceLayoutDirection
+#else
+ import AppKit
+ public typealias ConstraintInterfaceLayoutDirection = NSUserInterfaceLayoutDirection
+#endif
+
+
+public struct ConstraintConfig {
+
+ public static var interfaceLayoutDirection: ConstraintInterfaceLayoutDirection = .leftToRight
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintConstantTarget {
+}
+
+extension CGPoint: ConstraintConstantTarget {
+}
+
+extension CGSize: ConstraintConstantTarget {
+}
+
+extension ConstraintInsets: ConstraintConstantTarget {
+}
+
+#if canImport(UIKit)
+@available(iOS 11.0, tvOS 11.0, *)
+extension ConstraintDirectionalInsets: ConstraintConstantTarget {
+}
+#endif
+
+extension ConstraintConstantTarget {
+
+ internal func constraintConstantTargetValueFor(layoutAttribute: LayoutAttribute) -> CGFloat {
+ if let value = self as? CGFloat {
+ return value
+ }
+
+ if let value = self as? Float {
+ return CGFloat(value)
+ }
+
+ if let value = self as? Double {
+ return CGFloat(value)
+ }
+
+ if let value = self as? Int {
+ return CGFloat(value)
+ }
+
+ if let value = self as? UInt {
+ return CGFloat(value)
+ }
+
+ if let value = self as? CGSize {
+ if layoutAttribute == .width {
+ return value.width
+ } else if layoutAttribute == .height {
+ return value.height
+ } else {
+ return 0.0
+ }
+ }
+
+ if let value = self as? CGPoint {
+ #if canImport(UIKit)
+ switch layoutAttribute {
+ case .left, .right, .leading, .trailing, .centerX, .leftMargin, .rightMargin, .leadingMargin, .trailingMargin, .centerXWithinMargins:
+ return value.x
+ case .top, .bottom, .centerY, .topMargin, .bottomMargin, .centerYWithinMargins, .lastBaseline, .firstBaseline:
+ return value.y
+ case .width, .height, .notAnAttribute:
+ return 0.0
+ #if swift(>=5.0)
+ @unknown default:
+ return 0.0
+ #endif
+ }
+ #else
+ switch layoutAttribute {
+ case .left, .right, .leading, .trailing, .centerX:
+ return value.x
+ case .top, .bottom, .centerY, .lastBaseline, .firstBaseline:
+ return value.y
+ case .width, .height, .notAnAttribute:
+ return 0.0
+ #if swift(>=5.0)
+ @unknown default:
+ return 0.0
+ #endif
+ }
+ #endif
+ }
+
+ if let value = self as? ConstraintInsets {
+ #if canImport(UIKit)
+ switch layoutAttribute {
+ case .left, .leftMargin:
+ return value.left
+ case .top, .topMargin, .firstBaseline:
+ return value.top
+ case .right, .rightMargin:
+ return -value.right
+ case .bottom, .bottomMargin, .lastBaseline:
+ return -value.bottom
+ case .leading, .leadingMargin:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
+ case .trailing, .trailingMargin:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
+ case .centerX, .centerXWithinMargins:
+ return (value.left - value.right) / 2
+ case .centerY, .centerYWithinMargins:
+ return (value.top - value.bottom) / 2
+ case .width:
+ return -(value.left + value.right)
+ case .height:
+ return -(value.top + value.bottom)
+ case .notAnAttribute:
+ return 0.0
+ #if swift(>=5.0)
+ @unknown default:
+ return 0.0
+ #endif
+ }
+ #else
+ switch layoutAttribute {
+ case .left:
+ return value.left
+ case .top, .firstBaseline:
+ return value.top
+ case .right:
+ return -value.right
+ case .bottom, .lastBaseline:
+ return -value.bottom
+ case .leading:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.left : value.right
+ case .trailing:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.right : -value.left
+ case .centerX:
+ return (value.left - value.right) / 2
+ case .centerY:
+ return (value.top - value.bottom) / 2
+ case .width:
+ return -(value.left + value.right)
+ case .height:
+ return -(value.top + value.bottom)
+ case .notAnAttribute:
+ return 0.0
+ #if swift(>=5.0)
+ @unknown default:
+ return 0.0
+ #endif
+ }
+ #endif
+ }
+
+ #if canImport(UIKit)
+ if #available(iOS 11.0, tvOS 11.0, *), let value = self as? ConstraintDirectionalInsets {
+ switch layoutAttribute {
+ case .left, .leftMargin:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? value.leading : value.trailing
+ case .top, .topMargin, .firstBaseline:
+ return value.top
+ case .right, .rightMargin:
+ return (ConstraintConfig.interfaceLayoutDirection == .leftToRight) ? -value.trailing : -value.leading
+ case .bottom, .bottomMargin, .lastBaseline:
+ return -value.bottom
+ case .leading, .leadingMargin:
+ return value.leading
+ case .trailing, .trailingMargin:
+ return -value.trailing
+ case .centerX, .centerXWithinMargins:
+ return (value.leading - value.trailing) / 2
+ case .centerY, .centerYWithinMargins:
+ return (value.top - value.bottom) / 2
+ case .width:
+ return -(value.leading + value.trailing)
+ case .height:
+ return -(value.top + value.bottom)
+ case .notAnAttribute:
+ return 0.0
+ #if swift(>=5.0)
+ @unknown default:
+ return 0.0
+ #else
+ default:
+ return 0.0
+ #endif
+ }
+ }
+ #endif
+
+ return 0.0
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintDSL {
+
+ var target: AnyObject? { get }
+
+ func setLabel(_ value: String?)
+ func label() -> String?
+
+}
+extension ConstraintDSL {
+
+ public func setLabel(_ value: String?) {
+ objc_setAssociatedObject(self.target as Any, &labelKey, value, .OBJC_ASSOCIATION_COPY_NONATOMIC)
+ }
+ public func label() -> String? {
+ return objc_getAssociatedObject(self.target as Any, &labelKey) as? String
+ }
+
+}
+private var labelKey: UInt8 = 0
+
+
+public protocol ConstraintBasicAttributesDSL : ConstraintDSL {
+}
+extension ConstraintBasicAttributesDSL {
+
+ // MARK: Basics
+
+ public var left: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.left)
+ }
+
+ public var top: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
+ }
+
+ public var right: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.right)
+ }
+
+ public var bottom: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
+ }
+
+ public var leading: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leading)
+ }
+
+ public var trailing: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailing)
+ }
+
+ public var width: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.width)
+ }
+
+ public var height: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
+ }
+
+ public var centerX: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerX)
+ }
+
+ public var centerY: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerY)
+ }
+
+ public var edges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.edges)
+ }
+
+ public var directionalEdges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalEdges)
+ }
+
+ public var horizontalEdges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.horizontalEdges)
+ }
+
+ public var verticalEdges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.verticalEdges)
+ }
+
+ public var directionalHorizontalEdges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalHorizontalEdges)
+ }
+
+ public var directionalVerticalEdges: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalVerticalEdges)
+ }
+
+ public var size: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.size)
+ }
+
+ public var center: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.center)
+ }
+
+}
+
+public protocol ConstraintAttributesDSL : ConstraintBasicAttributesDSL {
+}
+extension ConstraintAttributesDSL {
+
+ // MARK: Baselines
+ @available(*, deprecated, renamed:"lastBaseline")
+ public var baseline: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
+ }
+
+ @available(iOS 8.0, OSX 10.11, *)
+ public var lastBaseline: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.lastBaseline)
+ }
+
+ @available(iOS 8.0, OSX 10.11, *)
+ public var firstBaseline: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.firstBaseline)
+ }
+
+ // MARK: Margins
+
+ @available(iOS 8.0, *)
+ public var leftMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leftMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var topMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.topMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var rightMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.rightMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var bottomMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottomMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var leadingMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.leadingMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var trailingMargin: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.trailingMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerXWithinMargins: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerXWithinMargins)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerYWithinMargins: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerYWithinMargins)
+ }
+
+ @available(iOS 8.0, *)
+ public var margins: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.margins)
+ }
+
+ @available(iOS 8.0, *)
+ public var directionalMargins: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.directionalMargins)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerWithinMargins: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.centerWithinMargins)
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class ConstraintDescription {
+
+ internal let item: LayoutConstraintItem
+ internal var attributes: ConstraintAttributes
+ internal var relation: ConstraintRelation? = nil
+ internal var sourceLocation: (String, UInt)? = nil
+ internal var label: String? = nil
+ internal var related: ConstraintItem? = nil
+ internal var multiplier: ConstraintMultiplierTarget = 1.0
+ internal var constant: ConstraintConstantTarget = 0.0
+ internal var priority: ConstraintPriorityTarget = 1000.0
+ internal lazy var constraint: Constraint? = {
+ guard let relation = self.relation,
+ let related = self.related,
+ let sourceLocation = self.sourceLocation else {
+ return nil
+ }
+ let from = ConstraintItem(target: self.item, attributes: self.attributes)
+
+ return Constraint(
+ from: from,
+ to: related,
+ relation: relation,
+ sourceLocation: sourceLocation,
+ label: self.label,
+ multiplier: self.multiplier,
+ constant: self.constant,
+ priority: self.priority
+ )
+ }()
+
+ // MARK: Initialization
+
+ internal init(item: LayoutConstraintItem, attributes: ConstraintAttributes) {
+ self.item = item
+ self.attributes = attributes
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+import UIKit
+#else
+import AppKit
+#endif
+
+#if canImport(UIKit)
+public protocol ConstraintDirectionalInsetTarget: ConstraintConstantTarget {
+}
+
+@available(iOS 11.0, tvOS 11.0, *)
+extension ConstraintDirectionalInsets: ConstraintDirectionalInsetTarget {
+}
+
+extension ConstraintDirectionalInsetTarget {
+
+ @available(iOS 11.0, tvOS 11.0, *)
+ internal var constraintDirectionalInsetTargetValue: ConstraintDirectionalInsets {
+ if let amount = self as? ConstraintDirectionalInsets {
+ return amount
+ } else {
+ return ConstraintDirectionalInsets(top: 0, leading: 0, bottom: 0, trailing: 0)
+ }
+ }
+}
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+#if canImport(UIKit)
+ @available(iOS 11.0, tvOS 11.0, *)
+ public typealias ConstraintDirectionalInsets = NSDirectionalEdgeInsets
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintInsetTarget: ConstraintConstantTarget {
+}
+
+extension Int: ConstraintInsetTarget {
+}
+
+extension UInt: ConstraintInsetTarget {
+}
+
+extension Float: ConstraintInsetTarget {
+}
+
+extension Double: ConstraintInsetTarget {
+}
+
+extension CGFloat: ConstraintInsetTarget {
+}
+
+extension ConstraintInsets: ConstraintInsetTarget {
+}
+
+extension ConstraintInsetTarget {
+
+ internal var constraintInsetTargetValue: ConstraintInsets {
+ if let amount = self as? ConstraintInsets {
+ return amount
+ } else if let amount = self as? Float {
+ return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
+ } else if let amount = self as? Double {
+ return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
+ } else if let amount = self as? CGFloat {
+ return ConstraintInsets(top: amount, left: amount, bottom: amount, right: amount)
+ } else if let amount = self as? Int {
+ return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
+ } else if let amount = self as? UInt {
+ return ConstraintInsets(top: CGFloat(amount), left: CGFloat(amount), bottom: CGFloat(amount), right: CGFloat(amount))
+ } else {
+ return ConstraintInsets(top: 0, left: 0, bottom: 0, right: 0)
+ }
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+#if canImport(UIKit)
+ public typealias ConstraintInsets = UIEdgeInsets
+#else
+ public typealias ConstraintInsets = NSEdgeInsets
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public final class ConstraintItem {
+
+ internal weak var target: AnyObject?
+ internal let attributes: ConstraintAttributes
+
+ internal init(target: AnyObject?, attributes: ConstraintAttributes) {
+ self.target = target
+ self.attributes = attributes
+ }
+
+ internal var layoutConstraintItem: LayoutConstraintItem? {
+ return self.target as? LayoutConstraintItem
+ }
+
+}
+
+public func ==(lhs: ConstraintItem, rhs: ConstraintItem) -> Bool {
+ // pointer equality
+ guard lhs !== rhs else {
+ return true
+ }
+
+ // must both have valid targets and identical attributes
+ guard let target1 = lhs.target,
+ let target2 = rhs.target,
+ target1 === target2 && lhs.attributes == rhs.attributes else {
+ return false
+ }
+
+ return true
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#endif
+
+
+@available(iOS 9.0, OSX 10.11, *)
+public extension ConstraintLayoutGuide {
+
+ var snp: ConstraintLayoutGuideDSL {
+ return ConstraintLayoutGuideDSL(guide: self)
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+#if canImport(UIKit)
+ @available(iOS 9.0, *)
+ public typealias ConstraintLayoutGuide = UILayoutGuide
+#else
+ @available(OSX 10.11, *)
+ public typealias ConstraintLayoutGuide = NSLayoutGuide
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+@available(iOS 9.0, OSX 10.11, *)
+public struct ConstraintLayoutGuideDSL: ConstraintAttributesDSL {
+
+ @discardableResult
+ public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
+ return ConstraintMaker.prepareConstraints(item: self.guide, closure: closure)
+ }
+
+ public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.makeConstraints(item: self.guide, closure: closure)
+ }
+
+ public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.remakeConstraints(item: self.guide, closure: closure)
+ }
+
+ public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.updateConstraints(item: self.guide, closure: closure)
+ }
+
+ public func removeConstraints() {
+ ConstraintMaker.removeConstraints(item: self.guide)
+ }
+
+ public var target: AnyObject? {
+ return self.guide
+ }
+
+ internal let guide: ConstraintLayoutGuide
+
+ internal init(guide: ConstraintLayoutGuide) {
+ self.guide = guide
+
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+#if canImport(UIKit)
+ @available(iOS 8.0, *)
+ public typealias ConstraintLayoutSupport = UILayoutSupport
+#else
+ public class ConstraintLayoutSupport {}
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+@available(iOS 8.0, *)
+public struct ConstraintLayoutSupportDSL: ConstraintDSL {
+
+ public var target: AnyObject? {
+ return self.support
+ }
+
+ internal let support: ConstraintLayoutSupport
+
+ internal init(support: ConstraintLayoutSupport) {
+ self.support = support
+
+ }
+
+ public var top: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.top)
+ }
+
+ public var bottom: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.bottom)
+ }
+
+ public var height: ConstraintItem {
+ return ConstraintItem(target: self.target, attributes: ConstraintAttributes.height)
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+public class ConstraintMaker {
+
+ public var left: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.left)
+ }
+
+ public var top: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.top)
+ }
+
+ public var bottom: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.bottom)
+ }
+
+ public var right: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.right)
+ }
+
+ public var leading: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.leading)
+ }
+
+ public var trailing: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.trailing)
+ }
+
+ public var width: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.width)
+ }
+
+ public var height: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.height)
+ }
+
+ public var centerX: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.centerX)
+ }
+
+ public var centerY: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.centerY)
+ }
+
+ @available(*, deprecated, renamed:"lastBaseline")
+ public var baseline: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.lastBaseline)
+ }
+
+ public var lastBaseline: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.lastBaseline)
+ }
+
+ @available(iOS 8.0, OSX 10.11, *)
+ public var firstBaseline: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.firstBaseline)
+ }
+
+ @available(iOS 8.0, *)
+ public var leftMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.leftMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var rightMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.rightMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var topMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.topMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var bottomMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.bottomMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var leadingMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.leadingMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var trailingMargin: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.trailingMargin)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerXWithinMargins: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.centerXWithinMargins)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerYWithinMargins: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.centerYWithinMargins)
+ }
+
+ public var edges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.edges)
+ }
+ public var horizontalEdges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.horizontalEdges)
+ }
+ public var verticalEdges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.verticalEdges)
+ }
+ public var directionalEdges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.directionalEdges)
+ }
+ public var directionalHorizontalEdges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.directionalHorizontalEdges)
+ }
+ public var directionalVerticalEdges: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.directionalVerticalEdges)
+ }
+ public var size: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.size)
+ }
+ public var center: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.center)
+ }
+
+ @available(iOS 8.0, *)
+ public var margins: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.margins)
+ }
+
+ @available(iOS 8.0, *)
+ public var directionalMargins: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.directionalMargins)
+ }
+
+ @available(iOS 8.0, *)
+ public var centerWithinMargins: ConstraintMakerExtendable {
+ return self.makeExtendableWithAttributes(.centerWithinMargins)
+ }
+
+ public let item: LayoutConstraintItem
+ private var descriptions = [ConstraintDescription]()
+
+ internal init(item: LayoutConstraintItem) {
+ self.item = item
+ self.item.prepare()
+ }
+
+ internal func makeExtendableWithAttributes(_ attributes: ConstraintAttributes) -> ConstraintMakerExtendable {
+ let description = ConstraintDescription(item: self.item, attributes: attributes)
+ self.descriptions.append(description)
+ return ConstraintMakerExtendable(description)
+ }
+
+ internal static func prepareConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
+ let maker = ConstraintMaker(item: item)
+ closure(maker)
+ var constraints: [Constraint] = []
+ for description in maker.descriptions {
+ guard let constraint = description.constraint else {
+ continue
+ }
+ constraints.append(constraint)
+ }
+ return constraints
+ }
+
+ internal static func makeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
+ let constraints = prepareConstraints(item: item, closure: closure)
+ for constraint in constraints {
+ constraint.activateIfNeeded(updatingExisting: false)
+ }
+ }
+
+ internal static func remakeConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
+ self.removeConstraints(item: item)
+ self.makeConstraints(item: item, closure: closure)
+ }
+
+ internal static func updateConstraints(item: LayoutConstraintItem, closure: (_ make: ConstraintMaker) -> Void) {
+ guard item.constraints.count > 0 else {
+ self.makeConstraints(item: item, closure: closure)
+ return
+ }
+
+ let constraints = prepareConstraints(item: item, closure: closure)
+ for constraint in constraints {
+ constraint.activateIfNeeded(updatingExisting: true)
+ }
+ }
+
+ internal static func removeConstraints(item: LayoutConstraintItem) {
+ let constraints = item.constraints
+ for constraint in constraints {
+ constraint.deactivateIfNeeded()
+ }
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class ConstraintMakerEditable: ConstraintMakerPrioritizable {
+
+ @discardableResult
+ public func multipliedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
+ self.description.multiplier = amount
+ return self
+ }
+
+ @discardableResult
+ public func dividedBy(_ amount: ConstraintMultiplierTarget) -> ConstraintMakerEditable {
+ return self.multipliedBy(1.0 / amount.constraintMultiplierTargetValue)
+ }
+
+ @discardableResult
+ public func offset(_ amount: ConstraintOffsetTarget) -> ConstraintMakerEditable {
+ self.description.constant = amount.constraintOffsetTargetValue
+ return self
+ }
+
+ @discardableResult
+ public func inset(_ amount: ConstraintInsetTarget) -> ConstraintMakerEditable {
+ self.description.constant = amount.constraintInsetTargetValue
+ return self
+ }
+
+ #if canImport(UIKit)
+ @discardableResult
+ @available(iOS 11.0, tvOS 11.0, *)
+ public func inset(_ amount: ConstraintDirectionalInsetTarget) -> ConstraintMakerEditable {
+ self.description.constant = amount.constraintDirectionalInsetTargetValue
+ return self
+ }
+ #endif
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class ConstraintMakerExtendable: ConstraintMakerRelatable {
+
+ public var left: ConstraintMakerExtendable {
+ self.description.attributes += .left
+ return self
+ }
+
+ public var top: ConstraintMakerExtendable {
+ self.description.attributes += .top
+ return self
+ }
+
+ public var bottom: ConstraintMakerExtendable {
+ self.description.attributes += .bottom
+ return self
+ }
+
+ public var right: ConstraintMakerExtendable {
+ self.description.attributes += .right
+ return self
+ }
+
+ public var leading: ConstraintMakerExtendable {
+ self.description.attributes += .leading
+ return self
+ }
+
+ public var trailing: ConstraintMakerExtendable {
+ self.description.attributes += .trailing
+ return self
+ }
+
+ public var width: ConstraintMakerExtendable {
+ self.description.attributes += .width
+ return self
+ }
+
+ public var height: ConstraintMakerExtendable {
+ self.description.attributes += .height
+ return self
+ }
+
+ public var centerX: ConstraintMakerExtendable {
+ self.description.attributes += .centerX
+ return self
+ }
+
+ public var centerY: ConstraintMakerExtendable {
+ self.description.attributes += .centerY
+ return self
+ }
+
+ @available(*, deprecated, renamed:"lastBaseline")
+ public var baseline: ConstraintMakerExtendable {
+ self.description.attributes += .lastBaseline
+ return self
+ }
+
+ public var lastBaseline: ConstraintMakerExtendable {
+ self.description.attributes += .lastBaseline
+ return self
+ }
+
+ @available(iOS 8.0, OSX 10.11, *)
+ public var firstBaseline: ConstraintMakerExtendable {
+ self.description.attributes += .firstBaseline
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var leftMargin: ConstraintMakerExtendable {
+ self.description.attributes += .leftMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var rightMargin: ConstraintMakerExtendable {
+ self.description.attributes += .rightMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var topMargin: ConstraintMakerExtendable {
+ self.description.attributes += .topMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var bottomMargin: ConstraintMakerExtendable {
+ self.description.attributes += .bottomMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var leadingMargin: ConstraintMakerExtendable {
+ self.description.attributes += .leadingMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var trailingMargin: ConstraintMakerExtendable {
+ self.description.attributes += .trailingMargin
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var centerXWithinMargins: ConstraintMakerExtendable {
+ self.description.attributes += .centerXWithinMargins
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var centerYWithinMargins: ConstraintMakerExtendable {
+ self.description.attributes += .centerYWithinMargins
+ return self
+ }
+
+ public var edges: ConstraintMakerExtendable {
+ self.description.attributes += .edges
+ return self
+ }
+ public var horizontalEdges: ConstraintMakerExtendable {
+ self.description.attributes += .horizontalEdges
+ return self
+ }
+ public var verticalEdges: ConstraintMakerExtendable {
+ self.description.attributes += .verticalEdges
+ return self
+ }
+ public var directionalEdges: ConstraintMakerExtendable {
+ self.description.attributes += .directionalEdges
+ return self
+ }
+ public var directionalHorizontalEdges: ConstraintMakerExtendable {
+ self.description.attributes += .directionalHorizontalEdges
+ return self
+ }
+ public var directionalVerticalEdges: ConstraintMakerExtendable {
+ self.description.attributes += .directionalVerticalEdges
+ return self
+ }
+ public var size: ConstraintMakerExtendable {
+ self.description.attributes += .size
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var margins: ConstraintMakerExtendable {
+ self.description.attributes += .margins
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var directionalMargins: ConstraintMakerExtendable {
+ self.description.attributes += .directionalMargins
+ return self
+ }
+
+ @available(iOS 8.0, *)
+ public var centerWithinMargins: ConstraintMakerExtendable {
+ self.description.attributes += .centerWithinMargins
+ return self
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class ConstraintMakerFinalizable {
+
+ internal let description: ConstraintDescription
+
+ internal init(_ description: ConstraintDescription) {
+ self.description = description
+ }
+
+ @discardableResult
+ public func labeled(_ label: String) -> ConstraintMakerFinalizable {
+ self.description.label = label
+ return self
+ }
+
+ public var constraint: Constraint {
+ return self.description.constraint!
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+@available(*, deprecated, message:"Use ConstraintMakerPrioritizable instead.")
+public typealias ConstraintMakerPriortizable = ConstraintMakerPrioritizable
+
+public class ConstraintMakerPrioritizable: ConstraintMakerFinalizable {
+
+ @discardableResult
+ public func priority(_ amount: ConstraintPriority) -> ConstraintMakerFinalizable {
+ self.description.priority = amount.value
+ return self
+ }
+
+ @discardableResult
+ public func priority(_ amount: ConstraintPriorityTarget) -> ConstraintMakerFinalizable {
+ self.description.priority = amount
+ return self
+ }
+
+ @available(*, deprecated, message:"Use priority(.required) instead.")
+ @discardableResult
+ public func priorityRequired() -> ConstraintMakerFinalizable {
+ return self.priority(.required)
+ }
+
+ @available(*, deprecated, message:"Use priority(.high) instead.")
+ @discardableResult
+ public func priorityHigh() -> ConstraintMakerFinalizable {
+ return self.priority(.high)
+ }
+
+ @available(*, deprecated, message:"Use priority(.medium) instead.")
+ @discardableResult
+ public func priorityMedium() -> ConstraintMakerFinalizable {
+ return self.priority(.medium)
+ }
+
+ @available(*, deprecated, message:"Use priority(.low) instead.")
+ @discardableResult
+ public func priorityLow() -> ConstraintMakerFinalizable {
+ return self.priority(.low)
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+extension ConstraintMakerRelatable {
+
+ @discardableResult
+ public func equalToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
+ }
+ return self.relatedTo(closure(other), relation: .equal, file: file, line: line)
+ }
+
+ @discardableResult
+ public func lessThanOrEqualToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
+ }
+ return self.relatedTo(closure(other), relation: .lessThanOrEqual, file: file, line: line)
+ }
+
+ @discardableResult
+ public func greaterThanOrEqualToSuperview<T: ConstraintRelatableTarget>(_ closure: (ConstraintView) -> T, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
+ }
+ return self.relatedTo(closure(other), relation: .greaterThanOrEqual, file: file, line: line)
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class ConstraintMakerRelatable {
+
+ internal let description: ConstraintDescription
+
+ internal init(_ description: ConstraintDescription) {
+ self.description = description
+ }
+
+ internal func relatedTo(_ other: ConstraintRelatableTarget, relation: ConstraintRelation, file: String, line: UInt) -> ConstraintMakerEditable {
+ let related: ConstraintItem
+ let constant: ConstraintConstantTarget
+
+ if let other = other as? ConstraintItem {
+ guard other.attributes == ConstraintAttributes.none ||
+ other.attributes.layoutAttributes.count <= 1 ||
+ other.attributes.layoutAttributes == self.description.attributes.layoutAttributes ||
+ other.attributes == .edges && self.description.attributes == .margins ||
+ other.attributes == .margins && self.description.attributes == .edges ||
+ other.attributes == .directionalEdges && self.description.attributes == .directionalMargins ||
+ other.attributes == .directionalMargins && self.description.attributes == .directionalEdges else {
+ fatalError("Cannot constraint to multiple non identical attributes. (\(file), \(line))");
+ }
+
+ related = other
+ constant = 0.0
+ } else if let other = other as? ConstraintView {
+ related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
+ constant = 0.0
+ } else if let other = other as? ConstraintConstantTarget {
+ related = ConstraintItem(target: nil, attributes: ConstraintAttributes.none)
+ constant = other
+ } else if #available(iOS 9.0, OSX 10.11, *), let other = other as? ConstraintLayoutGuide {
+ related = ConstraintItem(target: other, attributes: ConstraintAttributes.none)
+ constant = 0.0
+ } else {
+ fatalError("Invalid constraint. (\(file), \(line))")
+ }
+
+ let editable = ConstraintMakerEditable(self.description)
+ editable.description.sourceLocation = (file, line)
+ editable.description.relation = relation
+ editable.description.related = related
+ editable.description.constant = constant
+ return editable
+ }
+
+ @discardableResult
+ public func equalTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
+ return self.relatedTo(other, relation: .equal, file: file, line: line)
+ }
+
+ @discardableResult
+ public func equalToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `equalToSuperview`.")
+ }
+ return self.relatedTo(other, relation: .equal, file: file, line: line)
+ }
+
+ @discardableResult
+ public func lessThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
+ return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
+ }
+
+ @discardableResult
+ public func lessThanOrEqualToSuperview(_ file: String = #file, _ line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `lessThanOrEqualToSuperview`.")
+ }
+ return self.relatedTo(other, relation: .lessThanOrEqual, file: file, line: line)
+ }
+
+ @discardableResult
+ public func greaterThanOrEqualTo(_ other: ConstraintRelatableTarget, _ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
+ return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
+ }
+
+ @discardableResult
+ public func greaterThanOrEqualToSuperview(_ file: String = #file, line: UInt = #line) -> ConstraintMakerEditable {
+ guard let other = self.description.item.superview else {
+ fatalError("Expected superview but found nil when attempting make constraint `greaterThanOrEqualToSuperview`.")
+ }
+ return self.relatedTo(other, relation: .greaterThanOrEqual, file: file, line: line)
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintMultiplierTarget {
+
+ var constraintMultiplierTargetValue: CGFloat { get }
+
+}
+
+extension Int: ConstraintMultiplierTarget {
+
+ public var constraintMultiplierTargetValue: CGFloat {
+ return CGFloat(self)
+ }
+
+}
+
+extension UInt: ConstraintMultiplierTarget {
+
+ public var constraintMultiplierTargetValue: CGFloat {
+ return CGFloat(self)
+ }
+
+}
+
+extension Float: ConstraintMultiplierTarget {
+
+ public var constraintMultiplierTargetValue: CGFloat {
+ return CGFloat(self)
+ }
+
+}
+
+extension Double: ConstraintMultiplierTarget {
+
+ public var constraintMultiplierTargetValue: CGFloat {
+ return CGFloat(self)
+ }
+
+}
+
+extension CGFloat: ConstraintMultiplierTarget {
+
+ public var constraintMultiplierTargetValue: CGFloat {
+ return self
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintOffsetTarget: ConstraintConstantTarget {
+}
+
+extension Int: ConstraintOffsetTarget {
+}
+
+extension UInt: ConstraintOffsetTarget {
+}
+
+extension Float: ConstraintOffsetTarget {
+}
+
+extension Double: ConstraintOffsetTarget {
+}
+
+extension CGFloat: ConstraintOffsetTarget {
+}
+
+extension ConstraintOffsetTarget {
+
+ internal var constraintOffsetTargetValue: CGFloat {
+ let offset: CGFloat
+ if let amount = self as? Float {
+ offset = CGFloat(amount)
+ } else if let amount = self as? Double {
+ offset = CGFloat(amount)
+ } else if let amount = self as? CGFloat {
+ offset = CGFloat(amount)
+ } else if let amount = self as? Int {
+ offset = CGFloat(amount)
+ } else if let amount = self as? UInt {
+ offset = CGFloat(amount)
+ } else {
+ offset = 0.0
+ }
+ return offset
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+public struct ConstraintPriority : ExpressibleByFloatLiteral, Equatable, Strideable {
+ public typealias FloatLiteralType = Float
+
+ public let value: Float
+
+ public init(floatLiteral value: Float) {
+ self.value = value
+ }
+
+ public init(_ value: Float) {
+ self.value = value
+ }
+
+ public static var required: ConstraintPriority {
+ return 1000.0
+ }
+
+ public static var high: ConstraintPriority {
+ return 750.0
+ }
+
+ public static var medium: ConstraintPriority {
+ #if os(OSX)
+ return 501.0
+ #else
+ return 500.0
+ #endif
+
+ }
+
+ public static var low: ConstraintPriority {
+ return 250.0
+ }
+
+ public static func ==(lhs: ConstraintPriority, rhs: ConstraintPriority) -> Bool {
+ return lhs.value == rhs.value
+ }
+
+ // MARK: Strideable
+
+ public func advanced(by n: FloatLiteralType) -> ConstraintPriority {
+ return ConstraintPriority(floatLiteral: value + n)
+ }
+
+ public func distance(to other: ConstraintPriority) -> FloatLiteralType {
+ return other.value - value
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintPriorityTarget {
+
+ var constraintPriorityTargetValue: Float { get }
+
+}
+
+extension Int: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return Float(self)
+ }
+
+}
+
+extension UInt: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return Float(self)
+ }
+
+}
+
+extension Float: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return self
+ }
+
+}
+
+extension Double: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return Float(self)
+ }
+
+}
+
+extension CGFloat: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return Float(self)
+ }
+
+}
+
+#if canImport(UIKit)
+extension UILayoutPriority: ConstraintPriorityTarget {
+
+ public var constraintPriorityTargetValue: Float {
+ return self.rawValue
+ }
+
+}
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol ConstraintRelatableTarget {
+}
+
+extension Int: ConstraintRelatableTarget {
+}
+
+extension UInt: ConstraintRelatableTarget {
+}
+
+extension Float: ConstraintRelatableTarget {
+}
+
+extension Double: ConstraintRelatableTarget {
+}
+
+extension CGFloat: ConstraintRelatableTarget {
+}
+
+extension CGSize: ConstraintRelatableTarget {
+}
+
+extension CGPoint: ConstraintRelatableTarget {
+}
+
+extension ConstraintInsets: ConstraintRelatableTarget {
+}
+
+#if canImport(UIKit)
+@available(iOS 11.0, tvOS 11.0, *)
+extension ConstraintDirectionalInsets: ConstraintRelatableTarget {
+}
+#endif
+
+extension ConstraintItem: ConstraintRelatableTarget {
+}
+
+extension ConstraintView: ConstraintRelatableTarget {
+}
+
+@available(iOS 9.0, OSX 10.11, *)
+extension ConstraintLayoutGuide: ConstraintRelatableTarget {
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+internal enum ConstraintRelation : Int {
+ case equal = 1
+ case lessThanOrEqual
+ case greaterThanOrEqual
+
+ internal var layoutRelation: LayoutRelation {
+ get {
+ switch(self) {
+ case .equal:
+ return .equal
+ case .lessThanOrEqual:
+ return .lessThanOrEqual
+ case .greaterThanOrEqual:
+ return .greaterThanOrEqual
+ }
+ }
+ }
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public extension ConstraintView {
+
+ @available(*, deprecated, renamed:"snp.left")
+ var snp_left: ConstraintItem { return self.snp.left }
+
+ @available(*, deprecated, renamed:"snp.top")
+ var snp_top: ConstraintItem { return self.snp.top }
+
+ @available(*, deprecated, renamed:"snp.right")
+ var snp_right: ConstraintItem { return self.snp.right }
+
+ @available(*, deprecated, renamed:"snp.bottom")
+ var snp_bottom: ConstraintItem { return self.snp.bottom }
+
+ @available(*, deprecated, renamed:"snp.leading")
+ var snp_leading: ConstraintItem { return self.snp.leading }
+
+ @available(*, deprecated, renamed:"snp.trailing")
+ var snp_trailing: ConstraintItem { return self.snp.trailing }
+
+ @available(*, deprecated, renamed:"snp.width")
+ var snp_width: ConstraintItem { return self.snp.width }
+
+ @available(*, deprecated, renamed:"snp.height")
+ var snp_height: ConstraintItem { return self.snp.height }
+
+ @available(*, deprecated, renamed:"snp.centerX")
+ var snp_centerX: ConstraintItem { return self.snp.centerX }
+
+ @available(*, deprecated, renamed:"snp.centerY")
+ var snp_centerY: ConstraintItem { return self.snp.centerY }
+
+ @available(*, deprecated, renamed:"snp.baseline")
+ var snp_baseline: ConstraintItem { return self.snp.baseline }
+
+ @available(*, deprecated, renamed:"snp.lastBaseline")
+ @available(iOS 8.0, OSX 10.11, *)
+ var snp_lastBaseline: ConstraintItem { return self.snp.lastBaseline }
+
+ @available(iOS, deprecated, renamed:"snp.firstBaseline")
+ @available(iOS 8.0, OSX 10.11, *)
+ var snp_firstBaseline: ConstraintItem { return self.snp.firstBaseline }
+
+ @available(iOS, deprecated, renamed:"snp.leftMargin")
+ @available(iOS 8.0, *)
+ var snp_leftMargin: ConstraintItem { return self.snp.leftMargin }
+
+ @available(iOS, deprecated, renamed:"snp.topMargin")
+ @available(iOS 8.0, *)
+ var snp_topMargin: ConstraintItem { return self.snp.topMargin }
+
+ @available(iOS, deprecated, renamed:"snp.rightMargin")
+ @available(iOS 8.0, *)
+ var snp_rightMargin: ConstraintItem { return self.snp.rightMargin }
+
+ @available(iOS, deprecated, renamed:"snp.bottomMargin")
+ @available(iOS 8.0, *)
+ var snp_bottomMargin: ConstraintItem { return self.snp.bottomMargin }
+
+ @available(iOS, deprecated, renamed:"snp.leadingMargin")
+ @available(iOS 8.0, *)
+ var snp_leadingMargin: ConstraintItem { return self.snp.leadingMargin }
+
+ @available(iOS, deprecated, renamed:"snp.trailingMargin")
+ @available(iOS 8.0, *)
+ var snp_trailingMargin: ConstraintItem { return self.snp.trailingMargin }
+
+ @available(iOS, deprecated, renamed:"snp.centerXWithinMargins")
+ @available(iOS 8.0, *)
+ var snp_centerXWithinMargins: ConstraintItem { return self.snp.centerXWithinMargins }
+
+ @available(iOS, deprecated, renamed:"snp.centerYWithinMargins")
+ @available(iOS 8.0, *)
+ var snp_centerYWithinMargins: ConstraintItem { return self.snp.centerYWithinMargins }
+
+ @available(*, deprecated, renamed:"snp.edges")
+ var snp_edges: ConstraintItem { return self.snp.edges }
+
+ @available(*, deprecated, renamed:"snp.size")
+ var snp_size: ConstraintItem { return self.snp.size }
+
+ @available(*, deprecated, renamed:"snp.center")
+ var snp_center: ConstraintItem { return self.snp.center }
+
+ @available(iOS, deprecated, renamed:"snp.margins")
+ @available(iOS 8.0, *)
+ var snp_margins: ConstraintItem { return self.snp.margins }
+
+ @available(iOS, deprecated, renamed:"snp.centerWithinMargins")
+ @available(iOS 8.0, *)
+ var snp_centerWithinMargins: ConstraintItem { return self.snp.centerWithinMargins }
+
+ @available(*, deprecated, renamed:"snp.prepareConstraints(_:)")
+ func snp_prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
+ return self.snp.prepareConstraints(closure)
+ }
+
+ @available(*, deprecated, renamed:"snp.makeConstraints(_:)")
+ func snp_makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ self.snp.makeConstraints(closure)
+ }
+
+ @available(*, deprecated, renamed:"snp.remakeConstraints(_:)")
+ func snp_remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ self.snp.remakeConstraints(closure)
+ }
+
+ @available(*, deprecated, renamed:"snp.updateConstraints(_:)")
+ func snp_updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ self.snp.updateConstraints(closure)
+ }
+
+ @available(*, deprecated, renamed:"snp.removeConstraints()")
+ func snp_removeConstraints() {
+ self.snp.removeConstraints()
+ }
+
+ var snp: ConstraintViewDSL {
+ return ConstraintViewDSL(view: self)
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+#if canImport(UIKit)
+ public typealias ConstraintView = UIView
+#else
+ public typealias ConstraintView = NSView
+#endif
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public struct ConstraintViewDSL: ConstraintAttributesDSL {
+
+ @discardableResult
+ public func prepareConstraints(_ closure: (_ make: ConstraintMaker) -> Void) -> [Constraint] {
+ return ConstraintMaker.prepareConstraints(item: self.view, closure: closure)
+ }
+
+ public func makeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.makeConstraints(item: self.view, closure: closure)
+ }
+
+ public func remakeConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.remakeConstraints(item: self.view, closure: closure)
+ }
+
+ public func updateConstraints(_ closure: (_ make: ConstraintMaker) -> Void) {
+ ConstraintMaker.updateConstraints(item: self.view, closure: closure)
+ }
+
+ public func removeConstraints() {
+ ConstraintMaker.removeConstraints(item: self.view)
+ }
+
+ public var contentHuggingHorizontalPriority: Float {
+ get {
+ return self.view.contentHuggingPriority(for: .horizontal).rawValue
+ }
+ nonmutating set {
+ self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .horizontal)
+ }
+ }
+
+ public var contentHuggingVerticalPriority: Float {
+ get {
+ return self.view.contentHuggingPriority(for: .vertical).rawValue
+ }
+ nonmutating set {
+ self.view.setContentHuggingPriority(LayoutPriority(rawValue: newValue), for: .vertical)
+ }
+ }
+
+ public var contentCompressionResistanceHorizontalPriority: Float {
+ get {
+ return self.view.contentCompressionResistancePriority(for: .horizontal).rawValue
+ }
+ nonmutating set {
+ self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .horizontal)
+ }
+ }
+
+ public var contentCompressionResistanceVerticalPriority: Float {
+ get {
+ return self.view.contentCompressionResistancePriority(for: .vertical).rawValue
+ }
+ nonmutating set {
+ self.view.setContentCompressionResistancePriority(LayoutPriority(rawValue: newValue), for: .vertical)
+ }
+ }
+
+ public var target: AnyObject? {
+ return self.view
+ }
+
+ internal let view: ConstraintView
+
+ internal init(view: ConstraintView) {
+ self.view = view
+
+ }
+
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+public extension LayoutConstraint {
+
+ override var description: String {
+ var description = "<"
+
+ description += descriptionForObject(self)
+
+ if let firstItem = conditionalOptional(from: self.firstItem) {
+ description += " \(descriptionForObject(firstItem))"
+ }
+
+ if self.firstAttribute != .notAnAttribute {
+ description += ".\(descriptionForAttribute(self.firstAttribute))"
+ }
+
+ description += " \(descriptionForRelation(self.relation))"
+
+ if let secondItem = self.secondItem {
+ description += " \(descriptionForObject(secondItem))"
+ }
+
+ if self.secondAttribute != .notAnAttribute {
+ description += ".\(descriptionForAttribute(self.secondAttribute))"
+ }
+
+ if self.multiplier != 1.0 {
+ description += " * \(self.multiplier)"
+ }
+
+ if self.secondAttribute == .notAnAttribute {
+ description += " \(self.constant)"
+ } else {
+ if self.constant > 0.0 {
+ description += " + \(self.constant)"
+ } else if self.constant < 0.0 {
+ description += " - \(abs(self.constant))"
+ }
+ }
+
+ if self.priority.rawValue != 1000.0 {
+ description += " ^\(self.priority)"
+ }
+
+ description += ">"
+
+ return description
+ }
+
+}
+
+private func descriptionForRelation(_ relation: LayoutRelation) -> String {
+ switch relation {
+ case .equal: return "=="
+ case .greaterThanOrEqual: return ">="
+ case .lessThanOrEqual: return "<="
+ #if swift(>=5.0)
+ @unknown default: return "unknown"
+ #endif
+ }
+}
+
+private func descriptionForAttribute(_ attribute: LayoutAttribute) -> String {
+ #if canImport(UIKit)
+ switch attribute {
+ case .notAnAttribute: return "notAnAttribute"
+ case .top: return "top"
+ case .left: return "left"
+ case .bottom: return "bottom"
+ case .right: return "right"
+ case .leading: return "leading"
+ case .trailing: return "trailing"
+ case .width: return "width"
+ case .height: return "height"
+ case .centerX: return "centerX"
+ case .centerY: return "centerY"
+ case .lastBaseline: return "lastBaseline"
+ case .firstBaseline: return "firstBaseline"
+ case .topMargin: return "topMargin"
+ case .leftMargin: return "leftMargin"
+ case .bottomMargin: return "bottomMargin"
+ case .rightMargin: return "rightMargin"
+ case .leadingMargin: return "leadingMargin"
+ case .trailingMargin: return "trailingMargin"
+ case .centerXWithinMargins: return "centerXWithinMargins"
+ case .centerYWithinMargins: return "centerYWithinMargins"
+ #if swift(>=5.0)
+ @unknown default: return "unknown"
+ #endif
+ }
+ #else
+ switch attribute {
+ case .notAnAttribute: return "notAnAttribute"
+ case .top: return "top"
+ case .left: return "left"
+ case .bottom: return "bottom"
+ case .right: return "right"
+ case .leading: return "leading"
+ case .trailing: return "trailing"
+ case .width: return "width"
+ case .height: return "height"
+ case .centerX: return "centerX"
+ case .centerY: return "centerY"
+ case .lastBaseline: return "lastBaseline"
+ case .firstBaseline: return "firstBaseline"
+ #if swift(>=5.0)
+ @unknown default: return "unknown"
+ #endif
+ }
+ #endif
+}
+
+private func conditionalOptional<T>(from object: Optional<T>) -> Optional<T> {
+ return object
+}
+
+private func conditionalOptional<T>(from object: T) -> Optional<T> {
+ return Optional.some(object)
+}
+
+private func descriptionForObject(_ object: AnyObject) -> String {
+ let pointerDescription = String(format: "%p", UInt(bitPattern: ObjectIdentifier(object)))
+ var desc = ""
+
+ desc += type(of: object).description()
+
+ if let object = object as? ConstraintView {
+ desc += ":\(object.snp.label() ?? pointerDescription)"
+ } else if let object = object as? LayoutConstraint {
+ desc += ":\(object.label ?? pointerDescription)"
+ } else {
+ desc += ":\(pointerDescription)"
+ }
+
+ if let object = object as? LayoutConstraint, let file = object.constraint?.sourceLocation.0, let line = object.constraint?.sourceLocation.1 {
+ desc += "@\((file as NSString).lastPathComponent)#\(line)"
+ }
+
+ desc += ""
+ return desc
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public class LayoutConstraint : NSLayoutConstraint {
+
+ public var label: String? {
+ get {
+ return self.identifier
+ }
+ set {
+ self.identifier = newValue
+ }
+ }
+
+ internal weak var constraint: Constraint? = nil
+
+}
+
+internal func ==(lhs: LayoutConstraint, rhs: LayoutConstraint) -> Bool {
+ // If firstItem or secondItem on either constraint has a dangling pointer
+ // this comparison can cause a crash. The solution for this is to ensure
+ // your layout code hold strong references to things like Views, LayoutGuides
+ // and LayoutAnchors as SnapKit will not keep strong references to any of these.
+ guard lhs.firstAttribute == rhs.firstAttribute &&
+ lhs.secondAttribute == rhs.secondAttribute &&
+ lhs.relation == rhs.relation &&
+ lhs.priority == rhs.priority &&
+ lhs.multiplier == rhs.multiplier &&
+ lhs.secondItem === rhs.secondItem &&
+ lhs.firstItem === rhs.firstItem else {
+ return false
+ }
+ return true
+}
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#else
+ import AppKit
+#endif
+
+
+public protocol LayoutConstraintItem: AnyObject {
+}
+
+@available(iOS 9.0, OSX 10.11, *)
+extension ConstraintLayoutGuide : LayoutConstraintItem {
+}
+
+extension ConstraintView : LayoutConstraintItem {
+}
+
+
+extension LayoutConstraintItem {
+
+ internal func prepare() {
+ if let view = self as? ConstraintView {
+ view.translatesAutoresizingMaskIntoConstraints = false
+ }
+ }
+
+ internal var superview: ConstraintView? {
+ if let view = self as? ConstraintView {
+ return view.superview
+ }
+
+ if #available(iOS 9.0, OSX 10.11, *), let guide = self as? ConstraintLayoutGuide {
+ return guide.owningView
+ }
+
+ return nil
+ }
+ internal var constraints: [Constraint] {
+ return self.constraintsSet.allObjects as! [Constraint]
+ }
+
+ internal func add(constraints: [Constraint]) {
+ let constraintsSet = self.constraintsSet
+ for constraint in constraints {
+ constraintsSet.add(constraint)
+ }
+ }
+
+ internal func remove(constraints: [Constraint]) {
+ let constraintsSet = self.constraintsSet
+ for constraint in constraints {
+ constraintsSet.remove(constraint)
+ }
+ }
+
+ private var constraintsSet: NSMutableSet {
+ let constraintsSet: NSMutableSet
+
+ if let existing = objc_getAssociatedObject(self, &constraintsKey) as? NSMutableSet {
+ constraintsSet = existing
+ } else {
+ constraintsSet = NSMutableSet()
+ objc_setAssociatedObject(self, &constraintsKey, constraintsSet, .OBJC_ASSOCIATION_RETAIN_NONATOMIC)
+ }
+ return constraintsSet
+
+ }
+
+}
+private var constraintsKey: UInt8 = 0
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>NSPrivacyTracking</key>
+ <false/>
+ <key>NSPrivacyAccessedAPITypes</key>
+ <array/>
+ <key>NSPrivacyCollectedDataTypes</key>
+ <array/>
+ <key>NSPrivacyTrackingDomains</key>
+ <array/>
+</dict>
+</plist>
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+import Foundation
+
+#if canImport(UIKit)
+ import UIKit
+#if swift(>=4.2)
+ typealias LayoutRelation = NSLayoutConstraint.Relation
+ typealias LayoutAttribute = NSLayoutConstraint.Attribute
+#else
+ typealias LayoutRelation = NSLayoutRelation
+ typealias LayoutAttribute = NSLayoutAttribute
+#endif
+ typealias LayoutPriority = UILayoutPriority
+#else
+ import AppKit
+ typealias LayoutRelation = NSLayoutConstraint.Relation
+ typealias LayoutAttribute = NSLayoutConstraint.Attribute
+ typealias LayoutPriority = NSLayoutConstraint.Priority
+#endif
+
--- /dev/null
+//
+// SnapKit
+//
+// Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if canImport(UIKit)
+ import UIKit
+#endif
+
+
+@available(iOS 8.0, *)
+public extension ConstraintLayoutSupport {
+
+ var snp: ConstraintLayoutSupportDSL {
+ return ConstraintLayoutSupportDSL(support: self)
+ }
+
+}
--- /dev/null
+BSD License
+
+For SocketRocket software
+
+Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
\ No newline at end of file
--- /dev/null
+Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+
+The examples provided by Facebook are for non-commercial testing and evaluation
+purposes only. Facebook reserves all rights not expressly granted.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+# SocketRocket
+
+![Platforms][platforms-svg]
+[![License][license-svg]][license-link]
+
+[![Podspec][podspec-svg]][podspec-link]
+[![Carthage Compatible][carthage-svg]](carthage-link)
+
+[![Build Status][build-status-svg]][build-status-link]
+
+A conforming WebSocket ([RFC 6455](https://tools.ietf.org/html/rfc6455>)) client library for iOS, macOS and tvOS.
+
+Test results for SocketRocket [here](http://facebook.github.io/SocketRocket/results/).
+You can compare to what modern browsers look like [here](http://autobahn.ws/testsuite/reports/clients/index.html).
+
+SocketRocket currently conforms to all core ~300 of [Autobahn](http://autobahn.ws/testsuite/>)'s fuzzing tests
+(aside from two UTF-8 ones where it is merely *non-strict* tests 6.4.2 and 6.4.4).
+
+## Features/Design
+
+- TLS (wss) support, including self-signed certificates.
+- Seems to perform quite well.
+- Supports HTTP Proxies.
+- Supports IPv4/IPv6.
+- Supports SSL certificate pinning.
+- Sends `ping` and can process `pong` events.
+- Asynchronous and non-blocking. Most of the work is done on a background thread.
+- Supports iOS, macOS, tvOS.
+
+## Installing
+
+There are a few options. Choose one, or just figure it out:
+
+- **[CocoaPods](https://cocoapods.org)**
+
+ Add the following line to your Podfile:
+ ```ruby
+ pod 'SocketRocket'
+ ```
+ Run `pod install`, and you are all set.
+
+- **[Carthage](https://github.com/carthage/carthage)**
+
+ Add the following line to your Cartfile:
+ ```
+ github "facebook/SocketRocket"
+ ```
+ Run `carthage update`, and you should now have the latest version of `SocketRocket` in your `Carthage` folder.
+
+- **Using SocketRocket as a sub-project**
+
+ You can also include `SocketRocket` as a subproject inside of your application if you'd prefer, although we do not recommend this, as it will increase your indexing time significantly. To do so, just drag and drop the `SocketRocket.xcodeproj` file into your workspace.
+
+## API
+
+### `SRWebSocket`
+
+The Web Socket.
+
+#### Note:
+
+`SRWebSocket` will retain itself between `-(void)open` and when it closes, errors, or fails.
+This is similar to how `NSURLConnection` behaves (unlike `NSURLConnection`, `SRWebSocket` won't retain the delegate).
+
+#### Interface
+
+```objective-c
+@interface SRWebSocket : NSObject
+
+// Make it with this
+- (instancetype)initWithURLRequest:(NSURLRequest *)request;
+
+// Set this before opening
+@property (nonatomic, weak) id <SRWebSocketDelegate> delegate;
+
+// Open with this
+- (void)open;
+
+// Close it with this
+- (void)close;
+
+// Send a Data
+- (void)sendData:(nullable NSData *)data error:(NSError **)error;
+
+// Send a UTF8 String
+- (void)sendString:(NSString *)string error:(NSError **)error;
+
+@end
+```
+
+### `SRWebSocketDelegate`
+
+You implement this
+
+```objective-c
+@protocol SRWebSocketDelegate <NSObject>
+
+@optional
+
+- (void)webSocketDidOpen:(SRWebSocket *)webSocket;
+
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(NSString *)string;
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithData:(NSData *)data;
+
+- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
+- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;
+
+@end
+```
+
+## Testing
+
+Included are setup scripts for the python testing environment.
+It comes packaged with vitualenv so all the dependencies are installed in userland.
+
+To run the short test from the command line, run:
+```bash
+ make test
+```
+
+To run all the tests, run:
+```bash
+ make test_all
+```
+
+The short tests don't include the performance tests
+(the test harness is actually the bottleneck, not SocketRocket).
+
+The first time this is run, it may take a while to install the dependencies. It will be smooth sailing after that.
+
+You can also run tests inside Xcode, which runs the same thing, but makes it easier to debug.
+
+- Choose the `SocketRocketTests` target
+- Make sure your running destination is either your Mac or any Simulator
+- Run the test action (`⌘+U`)
+
+### TestChat Demo Application
+
+SocketRocket includes a demo app, TestChat.
+It will "chat" with a listening websocket on port 9900.
+
+#### TestChat Server
+
+The sever takes a message and broadcasts it to all other connected clients.
+
+It requires some dependencies though to run.
+We also want to reuse the virtualenv we made when we ran the tests.
+If you haven't run the tests yet, go into the SocketRocket root directory and type:
+
+```bash
+make test
+```
+
+This will set up your [virtualenv](https://pypi.python.org/pypi/virtualenv).
+
+Now, in your terminal:
+
+```bash
+source .env/bin/activate
+pip install git+https://github.com/tornadoweb/tornado.git
+```
+
+In the same terminal session, start the chatroom server:
+
+```bash
+python TestChatServer/py/chatroom.py
+```
+
+There's also a Go implementation (with the latest weekly) where you can:
+
+```bash
+cd TestChatServer/go
+go run chatroom.go
+```
+
+#### Chatting
+
+Now, start TestChat.app (just run the target in the Xcode project).
+If you had it started already you can hit the refresh button to reconnect.
+It should say "Connected!" on top.
+
+To talk with the app, open up your browser to [http://localhost:9000](http://localhost:9000) and start chatting.
+
+
+## WebSocket Server Implementation Recommendations
+
+SocketRocket has been used with the following libraries:
+
+- [Tornado](https://github.com/tornadoweb/tornado)
+- Go's [WebSocket package](https://godoc.org/golang.org/x/net/websocket) or Gorilla's [version](http://www.gorillatoolkit.org/pkg/websocket).
+- [Autobahn](http://autobahn.ws/testsuite/) (using its fuzzing client).
+
+The Tornado one is dirt simple and works like a charm.
+([IPython notebook](http://ipython.org/ipython-doc/dev/interactive/htmlnotebook.html) uses it too).
+It's much easier to configure handlers and routes than in Autobahn/twisted.
+
+## Contributing
+
+We’re glad you’re interested in SocketRocket, and we’d love to see where you take it.
+Please read our [contributing guidelines](https://github.com/facebook/SocketRocket/blob/master/CONTRIBUTING.md) prior to submitting a Pull Request.
+
+ [build-status-svg]: https://img.shields.io/travis/facebook/SocketRocket/master.svg
+ [build-status-link]: https://travis-ci.org/facebook/SocketRocket/branches
+
+ [license-svg]: https://img.shields.io/badge/license-BSD-lightgrey.svg
+ [license-link]: https://github.com/facebook/SocketRocket/blob/master/LICENSE
+
+ [podspec-svg]: https://img.shields.io/cocoapods/v/SocketRocket.svg
+ [podspec-link]: https://cocoapods.org/pods/SocketRocket
+
+ [carthage-svg]: https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat
+ [carthage-link]: https://github.com/carthage/carthage
+
+ [platforms-svg]: http://img.shields.io/cocoapods/p/SocketRocket.svg?style=flat
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <SocketRocket/SRWebSocket.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+#if OBJC_BOOL_IS_BOOL
+
+struct SRDelegateAvailableMethods {
+ BOOL didReceiveMessage : 1;
+ BOOL didReceiveMessageWithString : 1;
+ BOOL didReceiveMessageWithData : 1;
+ BOOL didOpen : 1;
+ BOOL didFailWithError : 1;
+ BOOL didCloseWithCode : 1;
+ BOOL didReceivePing : 1;
+ BOOL didReceivePong : 1;
+ BOOL shouldConvertTextFrameToString : 1;
+};
+
+#else
+
+struct SRDelegateAvailableMethods {
+ BOOL didReceiveMessage;
+ BOOL didReceiveMessageWithString;
+ BOOL didReceiveMessageWithData;
+ BOOL didOpen;
+ BOOL didFailWithError;
+ BOOL didCloseWithCode;
+ BOOL didReceivePing;
+ BOOL didReceivePong;
+ BOOL shouldConvertTextFrameToString;
+};
+
+#endif
+
+typedef struct SRDelegateAvailableMethods SRDelegateAvailableMethods;
+
+typedef void(^SRDelegateBlock)(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods);
+
+@interface SRDelegateController : NSObject
+
+@property (nonatomic, weak) id<SRWebSocketDelegate> delegate;
+@property (atomic, readonly) SRDelegateAvailableMethods availableDelegateMethods;
+
+@property (nullable, nonatomic, strong) dispatch_queue_t dispatchQueue;
+@property (nullable, nonatomic, strong) NSOperationQueue *operationQueue;
+
+///--------------------------------------
+#pragma mark - Perform
+///--------------------------------------
+
+- (void)performDelegateBlock:(SRDelegateBlock)block;
+- (void)performDelegateQueueBlock:(dispatch_block_t)block;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRDelegateController.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SRDelegateController ()
+
+@property (nonatomic, strong, readonly) dispatch_queue_t accessQueue;
+
+@property (atomic, assign, readwrite) SRDelegateAvailableMethods availableDelegateMethods;
+
+@end
+
+@implementation SRDelegateController
+
+@synthesize delegate = _delegate;
+@synthesize dispatchQueue = _dispatchQueue;
+@synthesize operationQueue = _operationQueue;
+
+///--------------------------------------
+#pragma mark - Init
+///--------------------------------------
+
+- (instancetype)init
+{
+ self = [super init];
+ if (!self) return self;
+
+ _accessQueue = dispatch_queue_create("com.facebook.socketrocket.delegate.access", DISPATCH_QUEUE_CONCURRENT);
+ _dispatchQueue = dispatch_get_main_queue();
+
+ return self;
+}
+
+///--------------------------------------
+#pragma mark - Accessors
+///--------------------------------------
+
+- (void)setDelegate:(id<SRWebSocketDelegate> _Nullable)delegate
+{
+ dispatch_barrier_async(self.accessQueue, ^{
+ self->_delegate = delegate;
+
+ self.availableDelegateMethods = (SRDelegateAvailableMethods){
+ .didReceiveMessage = [delegate respondsToSelector:@selector(webSocket:didReceiveMessage:)],
+ .didReceiveMessageWithString = [delegate respondsToSelector:@selector(webSocket:didReceiveMessageWithString:)],
+ .didReceiveMessageWithData = [delegate respondsToSelector:@selector(webSocket:didReceiveMessageWithData:)],
+ .didOpen = [delegate respondsToSelector:@selector(webSocketDidOpen:)],
+ .didFailWithError = [delegate respondsToSelector:@selector(webSocket:didFailWithError:)],
+ .didCloseWithCode = [delegate respondsToSelector:@selector(webSocket:didCloseWithCode:reason:wasClean:)],
+ .didReceivePing = [delegate respondsToSelector:@selector(webSocket:didReceivePingWithData:)],
+ .didReceivePong = [delegate respondsToSelector:@selector(webSocket:didReceivePong:)],
+ .shouldConvertTextFrameToString = [delegate respondsToSelector:@selector(webSocketShouldConvertTextFrameToString:)]
+ };
+ });
+}
+
+- (id<SRWebSocketDelegate> _Nullable)delegate
+{
+ __block id<SRWebSocketDelegate> delegate = nil;
+ dispatch_sync(self.accessQueue, ^{
+ delegate = self->_delegate;
+ });
+ return delegate;
+}
+
+- (void)setDispatchQueue:(dispatch_queue_t _Nullable)queue
+{
+ dispatch_barrier_async(self.accessQueue, ^{
+ self->_dispatchQueue = queue ?: dispatch_get_main_queue();
+ self->_operationQueue = nil;
+ });
+}
+
+- (dispatch_queue_t _Nullable)dispatchQueue
+{
+ __block dispatch_queue_t queue = nil;
+ dispatch_sync(self.accessQueue, ^{
+ queue = self->_dispatchQueue;
+ });
+ return queue;
+}
+
+- (void)setOperationQueue:(NSOperationQueue *_Nullable)queue
+{
+ dispatch_barrier_async(self.accessQueue, ^{
+ self->_dispatchQueue = queue ? nil : dispatch_get_main_queue();
+ self->_operationQueue = queue;
+ });
+}
+
+- (NSOperationQueue *_Nullable)operationQueue
+{
+ __block NSOperationQueue *queue = nil;
+ dispatch_sync(self.accessQueue, ^{
+ queue = self->_operationQueue;
+ });
+ return queue;
+}
+
+///--------------------------------------
+#pragma mark - Perform
+///--------------------------------------
+
+- (void)performDelegateBlock:(SRDelegateBlock)block
+{
+ __block __strong id<SRWebSocketDelegate> delegate = nil;
+ __block SRDelegateAvailableMethods availableMethods;
+ dispatch_sync(self.accessQueue, ^{
+ delegate = self->_delegate; // Not `OK` to go through `self`, since queue sync.
+ availableMethods = self.availableDelegateMethods; // `OK` to call through `self`, since no queue sync.
+ });
+ [self performDelegateQueueBlock:^{
+ block(delegate, availableMethods);
+ }];
+}
+
+- (void)performDelegateQueueBlock:(dispatch_block_t)block
+{
+ dispatch_queue_t dispatchQueue = self.dispatchQueue;
+ if (dispatchQueue) {
+ dispatch_async(dispatchQueue, block);
+ } else {
+ [self.operationQueue addOperationWithBlock:block];
+ }
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+@class SRWebSocket; // TODO: (nlutsenko) Remove dependency on SRWebSocket here.
+
+// Returns number of bytes consumed. Returning 0 means you didn't match.
+// Sends bytes to callback handler;
+typedef size_t (^stream_scanner)(NSData *collected_data);
+typedef void (^data_callback)(SRWebSocket *webSocket, NSData *data);
+
+@interface SRIOConsumer : NSObject {
+ stream_scanner _scanner;
+ data_callback _handler;
+ size_t _bytesNeeded;
+ BOOL _readToCurrentFrame;
+ BOOL _unmaskBytes;
+}
+@property (nonatomic, copy, readonly) stream_scanner consumer;
+@property (nonatomic, copy, readonly) data_callback handler;
+@property (nonatomic, assign) size_t bytesNeeded;
+@property (nonatomic, assign, readonly) BOOL readToCurrentFrame;
+@property (nonatomic, assign, readonly) BOOL unmaskBytes;
+
+- (void)resetWithScanner:(stream_scanner)scanner
+ handler:(data_callback)handler
+ bytesNeeded:(size_t)bytesNeeded
+ readToCurrentFrame:(BOOL)readToCurrentFrame
+ unmaskBytes:(BOOL)unmaskBytes;
+
+@end
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRIOConsumer.h"
+
+@implementation SRIOConsumer
+
+@synthesize bytesNeeded = _bytesNeeded;
+@synthesize consumer = _scanner;
+@synthesize handler = _handler;
+@synthesize readToCurrentFrame = _readToCurrentFrame;
+@synthesize unmaskBytes = _unmaskBytes;
+
+- (void)resetWithScanner:(stream_scanner)scanner
+ handler:(data_callback)handler
+ bytesNeeded:(size_t)bytesNeeded
+ readToCurrentFrame:(BOOL)readToCurrentFrame
+ unmaskBytes:(BOOL)unmaskBytes
+{
+ _scanner = [scanner copy];
+ _handler = [handler copy];
+ _bytesNeeded = bytesNeeded;
+ _readToCurrentFrame = readToCurrentFrame;
+ _unmaskBytes = unmaskBytes;
+ assert(_scanner || _bytesNeeded);
+}
+
+@end
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+#import "SRIOConsumer.h" // TODO: (nlutsenko) Convert to @class and constants file for block types
+
+// This class is not thread-safe, and is expected to always be run on the same queue.
+@interface SRIOConsumerPool : NSObject
+
+- (instancetype)initWithBufferCapacity:(NSUInteger)poolSize;
+
+- (SRIOConsumer *)consumerWithScanner:(stream_scanner)scanner
+ handler:(data_callback)handler
+ bytesNeeded:(size_t)bytesNeeded
+ readToCurrentFrame:(BOOL)readToCurrentFrame
+ unmaskBytes:(BOOL)unmaskBytes;
+- (void)returnConsumer:(SRIOConsumer *)consumer;
+
+@end
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRIOConsumerPool.h"
+
+@implementation SRIOConsumerPool {
+ NSUInteger _poolSize;
+ NSMutableArray<SRIOConsumer *> *_bufferedConsumers;
+}
+
+- (instancetype)initWithBufferCapacity:(NSUInteger)poolSize
+{
+ self = [super init];
+ if (self) {
+ _poolSize = poolSize;
+ _bufferedConsumers = [NSMutableArray arrayWithCapacity:poolSize];
+ }
+ return self;
+}
+
+- (instancetype)init
+{
+ return [self initWithBufferCapacity:8];
+}
+
+- (SRIOConsumer *)consumerWithScanner:(stream_scanner)scanner
+ handler:(data_callback)handler
+ bytesNeeded:(size_t)bytesNeeded
+ readToCurrentFrame:(BOOL)readToCurrentFrame
+ unmaskBytes:(BOOL)unmaskBytes
+{
+ SRIOConsumer *consumer = nil;
+ if (_bufferedConsumers.count) {
+ consumer = [_bufferedConsumers lastObject];
+ [_bufferedConsumers removeLastObject];
+ } else {
+ consumer = [[SRIOConsumer alloc] init];
+ }
+
+ [consumer resetWithScanner:scanner
+ handler:handler
+ bytesNeeded:bytesNeeded
+ readToCurrentFrame:readToCurrentFrame
+ unmaskBytes:unmaskBytes];
+
+ return consumer;
+}
+
+- (void)returnConsumer:(SRIOConsumer *)consumer
+{
+ if (_bufferedConsumers.count < _poolSize) {
+ [_bufferedConsumers addObject:consumer];
+ }
+}
+
+@end
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <SocketRocket/NSRunLoop+SRWebSocket.h>
+
+// Empty function that force links the object file for the category.
+extern void import_NSRunLoop_SRWebSocket(void);
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <SocketRocket/NSURLRequest+SRWebSocket.h>
+
+// Empty function that force links the object file for the category.
+extern void import_NSURLRequest_SRWebSocket(void);
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef void(^SRProxyConnectCompletion)(NSError *_Nullable error,
+ NSInputStream *_Nullable readStream,
+ NSOutputStream *_Nullable writeStream);
+
+@interface SRProxyConnect : NSObject
+
+- (instancetype)initWithURL:(NSURL *)url;
+
+- (void)openNetworkStreamWithCompletion:(SRProxyConnectCompletion)completion;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRProxyConnect.h"
+
+#import "NSRunLoop+SRWebSocket.h"
+#import "SRConstants.h"
+#import "SRError.h"
+#import "SRLog.h"
+#import "SRURLUtilities.h"
+
+@interface SRProxyConnect() <NSStreamDelegate>
+
+@property (nonatomic, strong) NSURL *url;
+@property (nonatomic, strong) NSInputStream *inputStream;
+@property (nonatomic, strong) NSOutputStream *outputStream;
+
+@end
+
+@implementation SRProxyConnect
+{
+ SRProxyConnectCompletion _completion;
+
+ NSString *_httpProxyHost;
+ uint32_t _httpProxyPort;
+
+ CFHTTPMessageRef _receivedHTTPHeaders;
+
+ NSString *_socksProxyHost;
+ uint32_t _socksProxyPort;
+ NSString *_socksProxyUsername;
+ NSString *_socksProxyPassword;
+
+ BOOL _connectionRequiresSSL;
+
+ NSMutableArray<NSData *> *_inputQueue;
+ dispatch_queue_t _writeQueue;
+}
+
+///--------------------------------------
+#pragma mark - Init
+///--------------------------------------
+
+-(instancetype)initWithURL:(NSURL *)url
+{
+ self = [super init];
+ if (!self) return self;
+
+ _url = url;
+ _connectionRequiresSSL = SRURLRequiresSSL(url);
+
+ _writeQueue = dispatch_queue_create("com.facebook.socketrocket.proxyconnect.write", DISPATCH_QUEUE_SERIAL);
+ _inputQueue = [NSMutableArray arrayWithCapacity:2];
+
+ return self;
+}
+
+- (void)dealloc
+{
+ // If we get deallocated before the socket open finishes - we need to cleanup everything.
+
+ [self.inputStream removeFromRunLoop:[NSRunLoop SR_networkRunLoop] forMode:NSDefaultRunLoopMode];
+ self.inputStream.delegate = nil;
+ [self.inputStream close];
+ self.inputStream = nil;
+
+ self.outputStream.delegate = nil;
+ [self.outputStream close];
+ self.outputStream = nil;
+}
+
+///--------------------------------------
+#pragma mark - Open
+///--------------------------------------
+
+- (void)openNetworkStreamWithCompletion:(SRProxyConnectCompletion)completion
+{
+ _completion = completion;
+ [self _configureProxy];
+}
+
+///--------------------------------------
+#pragma mark - Flow
+///--------------------------------------
+
+- (void)_didConnect
+{
+ SRDebugLog(@"_didConnect, return streams");
+ if (_connectionRequiresSSL) {
+ if (_httpProxyHost) {
+ // Must set the real peer name before turning on SSL
+ SRDebugLog(@"proxy set peer name to real host %@", self.url.host);
+ [self.outputStream setProperty:self.url.host forKey:@"_kCFStreamPropertySocketPeerName"];
+ }
+ }
+ if (_receivedHTTPHeaders) {
+ CFRelease(_receivedHTTPHeaders);
+ _receivedHTTPHeaders = NULL;
+ }
+
+ NSInputStream *inputStream = self.inputStream;
+ NSOutputStream *outputStream = self.outputStream;
+
+ self.inputStream = nil;
+ self.outputStream = nil;
+
+ [inputStream removeFromRunLoop:[NSRunLoop SR_networkRunLoop] forMode:NSDefaultRunLoopMode];
+ inputStream.delegate = nil;
+ outputStream.delegate = nil;
+
+ _completion(nil, inputStream, outputStream);
+}
+
+- (void)_failWithError:(NSError *)error
+{
+ SRDebugLog(@"_failWithError, return error");
+ if (!error) {
+ error = SRHTTPErrorWithCodeDescription(500, 2132,@"Proxy Error");
+ }
+
+ if (_receivedHTTPHeaders) {
+ CFRelease(_receivedHTTPHeaders);
+ _receivedHTTPHeaders = NULL;
+ }
+
+ self.inputStream.delegate = nil;
+ self.outputStream.delegate = nil;
+
+ [self.inputStream removeFromRunLoop:[NSRunLoop SR_networkRunLoop]
+ forMode:NSDefaultRunLoopMode];
+ [self.inputStream close];
+ [self.outputStream close];
+ self.inputStream = nil;
+ self.outputStream = nil;
+ _completion(error, nil, nil);
+}
+
+// get proxy setting from device setting
+- (void)_configureProxy
+{
+ SRDebugLog(@"configureProxy");
+ NSDictionary *proxySettings = CFBridgingRelease(CFNetworkCopySystemProxySettings());
+
+ // CFNetworkCopyProxiesForURL doesn't understand ws:// or wss://
+ NSURL *httpURL;
+ if (_connectionRequiresSSL) {
+ httpURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@", _url.host]];
+ } else {
+ httpURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", _url.host]];
+ }
+
+ NSArray *proxies = CFBridgingRelease(CFNetworkCopyProxiesForURL((__bridge CFURLRef)httpURL, (__bridge CFDictionaryRef)proxySettings));
+ if (proxies.count == 0) {
+ SRDebugLog(@"configureProxy no proxies");
+ [self _openConnection];
+ return; // no proxy
+ }
+ NSDictionary *settings = [proxies objectAtIndex:0];
+ NSString *proxyType = settings[(NSString *)kCFProxyTypeKey];
+ if ([proxyType isEqualToString:(NSString *)kCFProxyTypeAutoConfigurationURL]) {
+ NSURL *pacURL = settings[(NSString *)kCFProxyAutoConfigurationURLKey];
+ if (pacURL) {
+ [self _fetchPAC:pacURL withProxySettings:proxySettings];
+ return;
+ }
+ }
+ if ([proxyType isEqualToString:(__bridge NSString *)kCFProxyTypeAutoConfigurationJavaScript]) {
+ NSString *script = settings[(__bridge NSString *)kCFProxyAutoConfigurationJavaScriptKey];
+ if (script) {
+ [self _runPACScript:script withProxySettings:proxySettings];
+ return;
+ }
+ }
+ [self _readProxySettingWithType:proxyType settings:settings];
+
+ [self _openConnection];
+}
+
+- (void)_readProxySettingWithType:(NSString *)proxyType settings:(NSDictionary *)settings
+{
+ if ([proxyType isEqualToString:(NSString *)kCFProxyTypeHTTP] ||
+ [proxyType isEqualToString:(NSString *)kCFProxyTypeHTTPS]) {
+ _httpProxyHost = settings[(NSString *)kCFProxyHostNameKey];
+ NSNumber *portValue = settings[(NSString *)kCFProxyPortNumberKey];
+ if (portValue) {
+ _httpProxyPort = [portValue intValue];
+ }
+ }
+ if ([proxyType isEqualToString:(NSString *)kCFProxyTypeSOCKS]) {
+ _socksProxyHost = settings[(NSString *)kCFProxyHostNameKey];
+ NSNumber *portValue = settings[(NSString *)kCFProxyPortNumberKey];
+ if (portValue)
+ _socksProxyPort = [portValue intValue];
+ _socksProxyUsername = settings[(NSString *)kCFProxyUsernameKey];
+ _socksProxyPassword = settings[(NSString *)kCFProxyPasswordKey];
+ }
+ if (_httpProxyHost) {
+ SRDebugLog(@"Using http proxy %@:%u", _httpProxyHost, _httpProxyPort);
+ } else if (_socksProxyHost) {
+ SRDebugLog(@"Using socks proxy %@:%u", _socksProxyHost, _socksProxyPort);
+ } else {
+ SRDebugLog(@"configureProxy no proxies");
+ }
+}
+
+- (void)_fetchPAC:(NSURL *)PACurl withProxySettings:(NSDictionary *)proxySettings
+{
+ SRDebugLog(@"SRWebSocket fetchPAC:%@", PACurl);
+
+ if ([PACurl isFileURL]) {
+ NSError *error = nil;
+ NSString *script = [NSString stringWithContentsOfURL:PACurl
+ usedEncoding:NULL
+ error:&error];
+
+ if (error) {
+ [self _openConnection];
+ } else {
+ [self _runPACScript:script withProxySettings:proxySettings];
+ }
+ return;
+ }
+
+ NSString *scheme = [PACurl.scheme lowercaseString];
+ if (![scheme isEqualToString:@"http"] && ![scheme isEqualToString:@"https"]) {
+ // Don't know how to read data from this URL, we'll have to give up
+ // We'll simply assume no proxies, and start the request as normal
+ [self _openConnection];
+ return;
+ }
+ __weak typeof(self) wself = self;
+ NSURLRequest *request = [NSURLRequest requestWithURL:PACurl];
+ NSURLSession *session = [NSURLSession sharedSession];
+ [[session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
+ __strong typeof(wself) sself = wself;
+ if (!error) {
+ NSString *script = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
+ [sself _runPACScript:script withProxySettings:proxySettings];
+ } else {
+ [sself _openConnection];
+ }
+ }] resume];
+}
+
+- (void)_runPACScript:(NSString *)script withProxySettings:(NSDictionary *)proxySettings
+{
+ if (!script) {
+ [self _openConnection];
+ return;
+ }
+ SRDebugLog(@"runPACScript");
+ // From: http://developer.apple.com/samplecode/CFProxySupportTool/listing1.html
+ // Work around <rdar://problem/5530166>. This dummy call to
+ // CFNetworkCopyProxiesForURL initialise some state within CFNetwork
+ // that is required by CFNetworkCopyProxiesForAutoConfigurationScript.
+ CFBridgingRelease(CFNetworkCopyProxiesForURL((__bridge CFURLRef)_url, (__bridge CFDictionaryRef)proxySettings));
+
+ // Obtain the list of proxies by running the autoconfiguration script
+ CFErrorRef err = NULL;
+
+ // CFNetworkCopyProxiesForAutoConfigurationScript doesn't understand ws:// or wss://
+ NSURL *httpURL;
+ if (_connectionRequiresSSL)
+ httpURL = [NSURL URLWithString:[NSString stringWithFormat:@"https://%@", _url.host]];
+ else
+ httpURL = [NSURL URLWithString:[NSString stringWithFormat:@"http://%@", _url.host]];
+
+ NSArray *proxies = CFBridgingRelease(CFNetworkCopyProxiesForAutoConfigurationScript((__bridge CFStringRef)script,(__bridge CFURLRef)httpURL, &err));
+ if (!err && [proxies count] > 0) {
+ NSDictionary *settings = [proxies objectAtIndex:0];
+ NSString *proxyType = settings[(NSString *)kCFProxyTypeKey];
+ [self _readProxySettingWithType:proxyType settings:settings];
+ }
+ [self _openConnection];
+}
+
+- (void)_openConnection
+{
+ [self _initializeStreams];
+
+ [self.inputStream scheduleInRunLoop:[NSRunLoop SR_networkRunLoop]
+ forMode:NSDefaultRunLoopMode];
+ //[self.outputStream scheduleInRunLoop:[NSRunLoop SR_networkRunLoop]
+ // forMode:NSDefaultRunLoopMode];
+ [self.outputStream open];
+ [self.inputStream open];
+}
+
+- (void)_initializeStreams
+{
+ assert(_url.port.unsignedIntValue <= UINT32_MAX);
+ uint32_t port = _url.port.unsignedIntValue;
+ if (port == 0) {
+ port = (_connectionRequiresSSL ? 443 : 80);
+ }
+ NSString *host = _url.host;
+
+ if (_httpProxyHost) {
+ host = _httpProxyHost;
+ port = (_httpProxyPort ?: 80);
+ }
+
+ CFReadStreamRef readStream = NULL;
+ CFWriteStreamRef writeStream = NULL;
+
+ SRDebugLog(@"ProxyConnect connect stream to %@:%u", host, port);
+ CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)host, port, &readStream, &writeStream);
+
+ self.outputStream = CFBridgingRelease(writeStream);
+ self.inputStream = CFBridgingRelease(readStream);
+
+ if (_socksProxyHost) {
+ SRDebugLog(@"ProxyConnect set sock property stream to %@:%u user %@ password %@", _socksProxyHost, _socksProxyPort, _socksProxyUsername, _socksProxyPassword);
+ NSMutableDictionary *settings = [NSMutableDictionary dictionaryWithCapacity:4];
+ settings[NSStreamSOCKSProxyHostKey] = _socksProxyHost;
+ if (_socksProxyPort) {
+ settings[NSStreamSOCKSProxyPortKey] = @(_socksProxyPort);
+ }
+ if (_socksProxyUsername) {
+ settings[NSStreamSOCKSProxyUserKey] = _socksProxyUsername;
+ }
+ if (_socksProxyPassword) {
+ settings[NSStreamSOCKSProxyPasswordKey] = _socksProxyPassword;
+ }
+ [self.inputStream setProperty:settings forKey:NSStreamSOCKSProxyConfigurationKey];
+ [self.outputStream setProperty:settings forKey:NSStreamSOCKSProxyConfigurationKey];
+ }
+ self.inputStream.delegate = self;
+ self.outputStream.delegate = self;
+}
+
+- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
+{
+ SRDebugLog(@"stream handleEvent %u", eventCode);
+ switch (eventCode) {
+ case NSStreamEventOpenCompleted: {
+ if (aStream == self.inputStream) {
+ if (_httpProxyHost) {
+ [self _proxyDidConnect];
+ } else {
+ [self _didConnect];
+ }
+ }
+ } break;
+ case NSStreamEventErrorOccurred: {
+ [self _failWithError:aStream.streamError];
+ } break;
+ case NSStreamEventEndEncountered: {
+ [self _failWithError:aStream.streamError];
+ } break;
+ case NSStreamEventHasBytesAvailable: {
+ if (aStream == _inputStream) {
+ [self _processInputStream];
+ }
+ } break;
+ case NSStreamEventHasSpaceAvailable:
+ case NSStreamEventNone:
+ SRDebugLog(@"(default) %@", aStream);
+ break;
+ }
+}
+
+- (void)_proxyDidConnect
+{
+ SRDebugLog(@"Proxy Connected");
+ uint32_t port = _url.port.unsignedIntValue;
+ if (port == 0) {
+ port = (_connectionRequiresSSL ? 443 : 80);
+ }
+ // Send HTTP CONNECT Request
+ NSString *connectRequestStr = [NSString stringWithFormat:@"CONNECT %@:%u HTTP/1.1\r\nHost: %@\r\nConnection: keep-alive\r\nProxy-Connection: keep-alive\r\n\r\n", _url.host, port, _url.host];
+
+ NSData *message = [connectRequestStr dataUsingEncoding:NSUTF8StringEncoding];
+ SRDebugLog(@"Proxy sending %@", connectRequestStr);
+
+ [self _writeData:message];
+}
+
+///handles the incoming bytes and sending them to the proper processing method
+- (void)_processInputStream
+{
+ NSMutableData *buf = [NSMutableData dataWithCapacity:SRDefaultBufferSize()];
+ uint8_t *buffer = buf.mutableBytes;
+ NSInteger length = [_inputStream read:buffer maxLength:SRDefaultBufferSize()];
+
+ if (length <= 0) {
+ return;
+ }
+
+ BOOL process = (_inputQueue.count == 0);
+ [_inputQueue addObject:[NSData dataWithBytes:buffer length:length]];
+
+ if (process) {
+ [self _dequeueInput];
+ }
+}
+
+// dequeue the incoming input so it is processed in order
+
+- (void)_dequeueInput
+{
+ while (_inputQueue.count > 0) {
+ NSData *data = _inputQueue.firstObject;
+ [_inputQueue removeObjectAtIndex:0];
+
+ // No need to process any data further, we got the full header data.
+ if ([self _proxyProcessHTTPResponseWithData:data]) {
+ break;
+ }
+ }
+}
+//handle checking the proxy connection status
+- (BOOL)_proxyProcessHTTPResponseWithData:(NSData *)data
+{
+ if (_receivedHTTPHeaders == NULL) {
+ _receivedHTTPHeaders = CFHTTPMessageCreateEmpty(NULL, NO);
+ }
+
+ CFHTTPMessageAppendBytes(_receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);
+ if (CFHTTPMessageIsHeaderComplete(_receivedHTTPHeaders)) {
+ SRDebugLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(_receivedHTTPHeaders)));
+ [self _proxyHTTPHeadersDidFinish];
+ return YES;
+ }
+
+ return NO;
+}
+
+- (void)_proxyHTTPHeadersDidFinish
+{
+ NSInteger responseCode = CFHTTPMessageGetResponseStatusCode(_receivedHTTPHeaders);
+
+ if (responseCode >= 299) {
+ SRDebugLog(@"Connect to Proxy Request failed with response code %d", responseCode);
+ NSError *error = SRHTTPErrorWithCodeDescription(responseCode, 2132,
+ [NSString stringWithFormat:@"Received bad response code from proxy server: %d.",
+ (int)responseCode]);
+ [self _failWithError:error];
+ return;
+ }
+ SRDebugLog(@"proxy connect return %d, call socket connect", responseCode);
+ [self _didConnect];
+}
+
+static NSTimeInterval const SRProxyConnectWriteTimeout = 5.0;
+
+- (void)_writeData:(NSData *)data
+{
+ const uint8_t * bytes = data.bytes;
+ __block NSInteger timeout = (NSInteger)(SRProxyConnectWriteTimeout * 1000000); // wait timeout before giving up
+ __weak typeof(self) wself = self;
+ dispatch_async(_writeQueue, ^{
+ __strong typeof(wself) sself = self;
+ if (!sself) {
+ return;
+ }
+ NSOutputStream *outStream = sself.outputStream;
+ if (!outStream) {
+ return;
+ }
+ while (![outStream hasSpaceAvailable]) {
+ usleep(100); //wait until the socket is ready
+ timeout -= 100;
+ if (timeout < 0) {
+ NSError *error = SRHTTPErrorWithCodeDescription(408, 2132, @"Proxy timeout");
+ [sself _failWithError:error];
+ } else if (outStream.streamError != nil) {
+ [sself _failWithError:outStream.streamError];
+ }
+ }
+ [outStream write:bytes maxLength:data.length];
+ });
+}
+
+@end
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SRRunLoopThread : NSThread
+
+@property (nonatomic, strong, readonly) NSRunLoop *runLoop;
+
++ (instancetype)sharedThread;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRRunLoopThread.h"
+
+@interface SRRunLoopThread ()
+{
+ dispatch_group_t _waitGroup;
+}
+
+@property (nonatomic, strong, readwrite) NSRunLoop *runLoop;
+
+@end
+
+@implementation SRRunLoopThread
+
++ (instancetype)sharedThread
+{
+ static SRRunLoopThread *thread;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ thread = [[SRRunLoopThread alloc] init];
+ thread.name = @"com.facebook.SocketRocket.NetworkThread";
+ thread.qualityOfService = NSQualityOfServiceUserInitiated;
+ [thread start];
+ });
+ return thread;
+}
+
+- (instancetype)init
+{
+ self = [super init];
+ if (self) {
+ _waitGroup = dispatch_group_create();
+ dispatch_group_enter(_waitGroup);
+ }
+ return self;
+}
+
+- (void)main
+{
+ @autoreleasepool {
+ _runLoop = [NSRunLoop currentRunLoop];
+ dispatch_group_leave(_waitGroup);
+
+ // Add an empty run loop source to prevent runloop from spinning.
+ CFRunLoopSourceContext sourceCtx = {
+ .version = 0,
+ .info = NULL,
+ .retain = NULL,
+ .release = NULL,
+ .copyDescription = NULL,
+ .equal = NULL,
+ .hash = NULL,
+ .schedule = NULL,
+ .cancel = NULL,
+ .perform = NULL
+ };
+ CFRunLoopSourceRef source = CFRunLoopSourceCreate(NULL, 0, &sourceCtx);
+ CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopDefaultMode);
+ CFRelease(source);
+
+ while ([_runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) {
+
+ }
+ assert(NO);
+ }
+}
+
+- (NSRunLoop *)runLoop
+{
+ dispatch_group_wait(_waitGroup, DISPATCH_TIME_FOREVER);
+ return _runLoop;
+}
+
+@end
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+typedef NS_ENUM(uint8_t, SROpCode)
+{
+ SROpCodeTextFrame = 0x1,
+ SROpCodeBinaryFrame = 0x2,
+ // 3-7 reserved.
+ SROpCodeConnectionClose = 0x8,
+ SROpCodePing = 0x9,
+ SROpCodePong = 0xA,
+ // B-F reserved.
+};
+
+/**
+ Default buffer size that is used for reading/writing to streams.
+ */
+extern size_t SRDefaultBufferSize(void);
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRConstants.h"
+
+size_t SRDefaultBufferSize(void) {
+ static size_t size;
+ static dispatch_once_t onceToken;
+ dispatch_once(&onceToken, ^{
+ size = getpagesize();
+ });
+ return size;
+}
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+#import <SocketRocket/SRSecurityPolicy.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/**
+ * NOTE: While publicly, SocketRocket does not support configuring the security policy with pinned certificates,
+ * it is still possible to manually construct a security policy of this class. If you do this, note that you may
+ * be open to MitM attacks, and we will not support any issues you may have. Dive at your own risk.
+ */
+@interface SRPinningSecurityPolicy : SRSecurityPolicy
+
+- (instancetype)initWithCertificates:(NSArray *)pinnedCertificates;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRPinningSecurityPolicy.h"
+
+#import <Foundation/Foundation.h>
+
+#import "SRLog.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SRPinningSecurityPolicy ()
+
+@property (nonatomic, copy, readonly) NSArray *pinnedCertificates;
+
+@end
+
+@implementation SRPinningSecurityPolicy
+
+- (instancetype)initWithCertificates:(NSArray *)pinnedCertificates
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ // Do not validate certificate chain since we're pinning to specific certificates.
+ self = [super initWithCertificateChainValidationEnabled:NO];
+#pragma clang diagnostic pop
+
+ if (!self) { return self; }
+
+ if (pinnedCertificates.count == 0) {
+ @throw [NSException exceptionWithName:@"Creating security policy failed."
+ reason:@"Must specify at least one certificate when creating a pinning policy."
+ userInfo:nil];
+ }
+ _pinnedCertificates = [pinnedCertificates copy];
+
+ return self;
+}
+
+- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain
+{
+ SRDebugLog(@"Pinned cert count: %d", self.pinnedCertificates.count);
+ NSUInteger requiredCertCount = self.pinnedCertificates.count;
+
+ NSUInteger validatedCertCount = 0;
+ CFIndex serverCertCount = SecTrustGetCertificateCount(serverTrust);
+ for (CFIndex i = 0; i < serverCertCount; i++) {
+ SecCertificateRef cert = SecTrustGetCertificateAtIndex(serverTrust, i);
+ NSData *data = CFBridgingRelease(SecCertificateCopyData(cert));
+ for (id ref in self.pinnedCertificates) {
+ SecCertificateRef trustedCert = (__bridge SecCertificateRef)ref;
+ // TODO: (nlutsenko) Add caching, so we don't copy the data for every pinned cert all the time.
+ NSData *trustedCertData = CFBridgingRelease(SecCertificateCopyData(trustedCert));
+ if ([trustedCertData isEqualToData:data]) {
+ validatedCertCount++;
+ break;
+ }
+ }
+ }
+ return (requiredCertCount == validatedCertCount);
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern NSError *SRErrorWithDomainCodeDescription(NSString *domain, NSInteger code, NSString *description);
+extern NSError *SRErrorWithCodeDescription(NSInteger code, NSString *description);
+extern NSError *SRErrorWithCodeDescriptionUnderlyingError(NSInteger code, NSString *description, NSError *underlyingError);
+
+extern NSError *SRHTTPErrorWithCodeDescription(NSInteger httpCode, NSInteger errorCode, NSString *description);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRError.h"
+
+#import "SRWebSocket.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+NSError *SRErrorWithDomainCodeDescription(NSString *domain, NSInteger code, NSString *description)
+{
+ return [NSError errorWithDomain:domain code:code userInfo:@{ NSLocalizedDescriptionKey: description }];
+}
+
+NSError *SRErrorWithCodeDescription(NSInteger code, NSString *description)
+{
+ return SRErrorWithDomainCodeDescription(SRWebSocketErrorDomain, code, description);
+}
+
+NSError *SRErrorWithCodeDescriptionUnderlyingError(NSInteger code, NSString *description, NSError *underlyingError)
+{
+ return [NSError errorWithDomain:SRWebSocketErrorDomain
+ code:code
+ userInfo:@{ NSLocalizedDescriptionKey: description,
+ NSUnderlyingErrorKey: underlyingError }];
+}
+
+NSError *SRHTTPErrorWithCodeDescription(NSInteger httpCode, NSInteger errorCode, NSString *description)
+{
+ return [NSError errorWithDomain:SRWebSocketErrorDomain
+ code:errorCode
+ userInfo:@{ NSLocalizedDescriptionKey: description,
+ SRHTTPResponseErrorKey: @(httpCode) }];
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+#import <CFNetwork/CFNetwork.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern CFHTTPMessageRef SRHTTPConnectMessageCreate(NSURLRequest *request,
+ NSString *securityKey,
+ uint8_t webSocketProtocolVersion,
+ NSArray<NSHTTPCookie *> *_Nullable cookies,
+ NSArray<NSString *> *_Nullable requestedProtocols);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRHTTPConnectMessage.h"
+
+#import "SRURLUtilities.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+static NSString *_SRHTTPConnectMessageHost(NSURL *url)
+{
+ NSString *host = url.host;
+ if (url.port) {
+ host = [host stringByAppendingFormat:@":%@", url.port];
+ }
+ return host;
+}
+
+CFHTTPMessageRef SRHTTPConnectMessageCreate(NSURLRequest *request,
+ NSString *securityKey,
+ uint8_t webSocketProtocolVersion,
+ NSArray<NSHTTPCookie *> *_Nullable cookies,
+ NSArray<NSString *> *_Nullable requestedProtocols)
+{
+ NSURL *url = request.URL;
+
+ CFHTTPMessageRef message = CFHTTPMessageCreateRequest(NULL, (__bridge CFStringRef)request.HTTPMethod, (__bridge CFURLRef)url, kCFHTTPVersion1_1);
+
+ // Set host first so it defaults
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Host"), (__bridge CFStringRef)_SRHTTPConnectMessageHost(url));
+
+ // Apply cookies if any have been provided
+ if (cookies) {
+ NSDictionary<NSString *, NSString *> *messageCookies = [NSHTTPCookie requestHeaderFieldsWithCookies:(NSArray<NSHTTPCookie*> *_Nonnull)cookies];
+ [messageCookies enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull key, NSString * _Nonnull obj, BOOL * _Nonnull stop) {
+ if (key.length && obj.length) {
+ CFHTTPMessageSetHeaderFieldValue(message, (__bridge CFStringRef)key, (__bridge CFStringRef)obj);
+ }
+ }];
+ }
+
+ // set header for http basic auth
+ NSString *basicAuthorizationString = SRBasicAuthorizationHeaderFromURL(url);
+ if (basicAuthorizationString) {
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Authorization"), (__bridge CFStringRef)basicAuthorizationString);
+ }
+
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Upgrade"), CFSTR("websocket"));
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Connection"), CFSTR("Upgrade"));
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Sec-WebSocket-Key"), (__bridge CFStringRef)securityKey);
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Sec-WebSocket-Version"), (__bridge CFStringRef)@(webSocketProtocolVersion).stringValue);
+
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Origin"), (__bridge CFStringRef)SRURLOrigin(url));
+
+ if (requestedProtocols.count) {
+ CFHTTPMessageSetHeaderFieldValue(message, CFSTR("Sec-WebSocket-Protocol"),
+ (__bridge CFStringRef)[requestedProtocols componentsJoinedByString:@", "]);
+ }
+
+ [request.allHTTPHeaderFields enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
+ CFHTTPMessageSetHeaderFieldValue(message, (__bridge CFStringRef)key, (__bridge CFStringRef)obj);
+ }];
+
+ return message;
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern NSData *SRSHA1HashFromString(NSString *string);
+extern NSData *SRSHA1HashFromBytes(const char *bytes, size_t length);
+
+extern NSString *SRBase64EncodedStringFromData(NSData *data);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRHash.h"
+
+#import <CommonCrypto/CommonDigest.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+NSData *SRSHA1HashFromString(NSString *string)
+{
+ const char *utf8String = string.UTF8String;
+ if (!utf8String) {
+ return [NSData data];
+ }
+ size_t length = [string lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ return SRSHA1HashFromBytes(utf8String, length);
+}
+
+NSData *SRSHA1HashFromBytes(const char *bytes, size_t length)
+{
+ uint8_t outputLength = CC_SHA1_DIGEST_LENGTH;
+ unsigned char output[outputLength];
+ CC_SHA1(bytes, (CC_LONG)length, output);
+
+ return [NSData dataWithBytes:output length:outputLength];
+}
+
+NSString *SRBase64EncodedStringFromData(NSData *data)
+{
+ if ([data respondsToSelector:@selector(base64EncodedStringWithOptions:)]) {
+ return [data base64EncodedStringWithOptions:0];
+ }
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+ return [data base64Encoding];
+#pragma clang diagnostic pop
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+// Uncomment this line to enable debug logging
+//#define SR_DEBUG_LOG_ENABLED
+
+extern void SRErrorLog(NSString *format, ...);
+extern void SRDebugLog(NSString *format, ...);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRLog.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern void SRErrorLog(NSString *format, ...)
+{
+ __block va_list arg_list;
+ va_start (arg_list, format);
+
+ NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:arg_list];
+
+ va_end(arg_list);
+
+ NSLog(@"[SocketRocket] %@", formattedString);
+}
+
+extern void SRDebugLog(NSString *format, ...)
+{
+#ifdef SR_DEBUG_LOG_ENABLED
+ SRErrorLog(tag, format);
+#endif
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef __attribute__((capability("mutex"))) pthread_mutex_t *SRMutex;
+
+extern SRMutex SRMutexInitRecursive(void);
+extern void SRMutexDestroy(SRMutex mutex);
+
+extern void SRMutexLock(SRMutex mutex) __attribute__((acquire_capability(mutex)));
+extern void SRMutexUnlock(SRMutex mutex) __attribute__((release_capability(mutex)));
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRMutex.h"
+
+#import <pthread/pthread.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+SRMutex SRMutexInitRecursive(void)
+{
+ pthread_mutex_t *mutex = malloc(sizeof(pthread_mutex_t));
+ pthread_mutexattr_t attributes;
+
+ pthread_mutexattr_init(&attributes);
+ pthread_mutexattr_settype(&attributes, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(mutex, &attributes);
+ pthread_mutexattr_destroy(&attributes);
+
+ return mutex;
+}
+
+void SRMutexDestroy(SRMutex mutex)
+{
+ pthread_mutex_destroy(mutex);
+ free(mutex);
+}
+
+__attribute__((no_thread_safety_analysis))
+void SRMutexLock(SRMutex mutex)
+{
+ pthread_mutex_lock(mutex);
+}
+
+__attribute__((no_thread_safety_analysis))
+void SRMutexUnlock(SRMutex mutex)
+{
+ pthread_mutex_unlock(mutex);
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+extern NSData *SRRandomData(NSUInteger length);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRRandom.h"
+
+#import <Security/SecRandom.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+NSData *SRRandomData(NSUInteger length)
+{
+ NSMutableData *_Nullable data = [NSMutableData dataWithLength:length];
+ if (data == nil) {
+ [NSException raise:NSInternalInconsistencyException format:@"Failed to allocate random data"];
+ }
+ int result = SecRandomCopyBytes(kSecRandomDefault, data.length, ((NSMutableData *_Nonnull)data).mutableBytes);
+ if (result != errSecSuccess) {
+ [NSException raise:NSInternalInconsistencyException format:@"Failed to generate random bytes with OSStatus: %d", result];
+ }
+ return (NSMutableData *_Nonnull)data;
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+/**
+ Unmask bytes using XOR via SIMD.
+
+ @param bytes The bytes to unmask.
+ @param length The number of bytes to unmask.
+ @param maskKey The mask to XOR with MUST be of length sizeof(uint32_t).
+ */
+void SRMaskBytesSIMD(uint8_t *bytes, size_t length, uint8_t *maskKey);
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRSIMDHelpers.h"
+
+typedef uint8_t uint8x32_t __attribute__((vector_size(32)));
+
+static void SRMaskBytesManual(uint8_t *bytes, size_t length, uint8_t *maskKey) {
+ for (size_t i = 0; i < length; i++) {
+ bytes[i] = bytes[i] ^ maskKey[i % sizeof(uint32_t)];
+ }
+}
+
+/**
+ Right-shift the elements of a vector, circularly.
+
+ @param vector The vector to circular shift.
+ @param by The number of elements to shift by.
+
+ @return A shifted vector.
+ */
+static uint8x32_t SRShiftVector(uint8x32_t vector, size_t by) {
+ uint8x32_t vectorCopy = vector;
+ by = by % _Alignof(uint8x32_t);
+
+ uint8_t *vectorPointer = (uint8_t *)&vector;
+ uint8_t *vectorCopyPointer = (uint8_t *)&vectorCopy;
+
+ memmove(vectorPointer + by, vectorPointer, sizeof(vector) - by);
+ memcpy(vectorPointer, vectorCopyPointer + (sizeof(vector) - by), by);
+
+ return vector;
+}
+
+void SRMaskBytesSIMD(uint8_t *bytes, size_t length, uint8_t *maskKey) {
+ size_t alignmentBytes = _Alignof(uint8x32_t) - ((uintptr_t)bytes % _Alignof(uint8x32_t));
+ if (alignmentBytes == _Alignof(uint8x32_t)) {
+ alignmentBytes = 0;
+ }
+
+ // If the number of bytes that can be processed after aligning is
+ // less than the number of bytes we can put into a vector,
+ // then there's no work to do with SIMD, just call the manual version.
+ if (alignmentBytes > length || (length - alignmentBytes) < sizeof(uint8x32_t)) {
+ SRMaskBytesManual(bytes, length, maskKey);
+ return;
+ }
+
+ size_t vectorLength = (length - alignmentBytes) / sizeof(uint8x32_t);
+ size_t manualStartOffset = alignmentBytes + (vectorLength * sizeof(uint8x32_t));
+ size_t manualLength = length - manualStartOffset;
+
+ uint8x32_t *vector = (uint8x32_t *)(bytes + alignmentBytes);
+ uint8x32_t maskVector;
+
+ memset_pattern4(&maskVector, maskKey, sizeof(uint8x32_t));
+ maskVector = SRShiftVector(maskVector, alignmentBytes);
+
+ SRMaskBytesManual(bytes, alignmentBytes, maskKey);
+
+ for (size_t vectorIndex = 0; vectorIndex < vectorLength; vectorIndex++) {
+ vector[vectorIndex] = vector[vectorIndex] ^ maskVector;
+ }
+
+ // Use the shifted mask for the final manual part.
+ SRMaskBytesManual(bytes + manualStartOffset, manualLength, (uint8_t *) &maskVector);
+}
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+// The origin isn't really applicable for a native application.
+// So instead, just map ws -> http and wss -> https.
+extern NSString *SRURLOrigin(NSURL *url);
+
+extern BOOL SRURLRequiresSSL(NSURL *_Nullable url);
+
+// Extracts `user` and `password` from url (if available) into `Basic base64(user:password)`.
+extern NSString *_Nullable SRBasicAuthorizationHeaderFromURL(NSURL *url);
+
+// Returns a valid value for `NSStreamNetworkServiceType` or `nil`.
+extern NSString *_Nullable SRStreamNetworkServiceTypeFromURLRequest(NSURLRequest *request);
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRURLUtilities.h"
+
+#import "SRHash.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+NSString *SRURLOrigin(NSURL *url)
+{
+ NSMutableString *origin = [NSMutableString string];
+
+ NSString *scheme = url.scheme.lowercaseString;
+ if ([scheme isEqualToString:@"wss"]) {
+ scheme = @"https";
+ } else if ([scheme isEqualToString:@"ws"]) {
+ scheme = @"http";
+ }
+ [origin appendFormat:@"%@://%@", scheme, url.host];
+
+ NSNumber *port = url.port;
+ BOOL portIsDefault = (!port ||
+ ([scheme isEqualToString:@"http"] && port.integerValue == 80) ||
+ ([scheme isEqualToString:@"https"] && port.integerValue == 443));
+ if (!portIsDefault) {
+ [origin appendFormat:@":%@", port.stringValue];
+ }
+ return origin;
+}
+
+extern BOOL SRURLRequiresSSL(NSURL *_Nullable url)
+{
+ NSString *scheme = url.scheme.lowercaseString;
+ return ([scheme isEqualToString:@"wss"] || [scheme isEqualToString:@"https"]);
+}
+
+extern NSString *_Nullable SRBasicAuthorizationHeaderFromURL(NSURL *url)
+{
+ if (!url.user || !url.password) {
+ return nil;
+ }
+
+ NSData *data = [[NSString stringWithFormat:@"%@:%@", url.user, url.password] dataUsingEncoding:NSUTF8StringEncoding];
+ return [NSString stringWithFormat:@"Basic %@", SRBase64EncodedStringFromData(data)];
+}
+
+extern NSString *_Nullable SRStreamNetworkServiceTypeFromURLRequest(NSURLRequest *request)
+{
+ NSString *networkServiceType = nil;
+ switch (request.networkServiceType) {
+ case NSURLNetworkServiceTypeDefault:
+ case NSURLNetworkServiceTypeResponsiveData:
+ case NSURLNetworkServiceTypeAVStreaming:
+ case NSURLNetworkServiceTypeResponsiveAV:
+ break;
+ case NSURLNetworkServiceTypeVoIP:
+ networkServiceType = NSStreamNetworkServiceTypeVoIP;
+ break;
+ case NSURLNetworkServiceTypeVideo:
+ networkServiceType = NSStreamNetworkServiceTypeVideo;
+ break;
+ case NSURLNetworkServiceTypeBackground:
+ networkServiceType = NSStreamNetworkServiceTypeBackground;
+ break;
+ case NSURLNetworkServiceTypeVoice:
+ networkServiceType = NSStreamNetworkServiceTypeVoice;
+ break;
+#if (__MAC_OS_X_VERSION_MAX_ALLOWED >= 101200 || __IPHONE_OS_VERSION_MAX_ALLOWED >= 100000 || __TV_OS_VERSION_MAX_ALLOWED >= 100000 || __WATCH_OS_VERSION_MAX_ALLOWED >= 30000)
+ case NSURLNetworkServiceTypeCallSignaling: {
+ if (@available(iOS 10.0, tvOS 10.0, macOS 10.12, *)) {
+ networkServiceType = NSStreamNetworkServiceTypeCallSignaling;
+ }
+ } break;
+#endif
+ }
+ return networkServiceType;
+}
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSRunLoop (SRWebSocket)
+
+/**
+ Default run loop that will be used to schedule all instances of `SRWebSocket`.
+
+ @return An instance of `NSRunLoop`.
+ */
++ (NSRunLoop *)SR_networkRunLoop;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "NSRunLoop+SRWebSocket.h"
+#import "NSRunLoop+SRWebSocketPrivate.h"
+
+#import "SRRunLoopThread.h"
+
+// Required for object file to always be linked.
+void import_NSRunLoop_SRWebSocket(void) { }
+
+@implementation NSRunLoop (SRWebSocket)
+
++ (NSRunLoop *)SR_networkRunLoop
+{
+ return [SRRunLoopThread sharedThread].runLoop;
+}
+
+@end
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface NSURLRequest (SRWebSocket)
+
+/**
+ An array of pinned `SecCertificateRef` SSL certificates that `SRWebSocket` will use for validation.
+ */
+@property (nullable, nonatomic, copy, readonly) NSArray *SR_SSLPinnedCertificates
+ DEPRECATED_MSG_ATTRIBUTE("Using pinned certificates is neither secure nor supported in SocketRocket, "
+ "and leads to security issues. Please use a proper, trust chain validated certificate.");
+
+@end
+
+@interface NSMutableURLRequest (SRWebSocket)
+
+/**
+ An array of pinned `SecCertificateRef` SSL certificates that `SRWebSocket` will use for validation.
+ */
+@property (nullable, nonatomic, copy) NSArray *SR_SSLPinnedCertificates
+ DEPRECATED_MSG_ATTRIBUTE("Using pinned certificates is neither secure nor supported in SocketRocket, "
+ "and leads to security issues. Please use a proper, trust chain validated certificate.");
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "NSURLRequest+SRWebSocket.h"
+#import "NSURLRequest+SRWebSocketPrivate.h"
+
+// Required for object file to always be linked.
+void import_NSURLRequest_SRWebSocket(void) { }
+
+NS_ASSUME_NONNULL_BEGIN
+
+static NSString *const SRSSLPinnnedCertificatesKey = @"SocketRocket_SSLPinnedCertificates";
+
+@implementation NSURLRequest (SRWebSocket)
+
+- (nullable NSArray *)SR_SSLPinnedCertificates
+{
+ return nil;
+}
+
+@end
+
+@implementation NSMutableURLRequest (SRWebSocket)
+
+- (void)setSR_SSLPinnedCertificates:(nullable NSArray *)SR_SSLPinnedCertificates
+{
+ [NSException raise:NSInvalidArgumentException
+ format:@"Using pinned certificates is neither secure nor supported in SocketRocket, "
+ "and leads to security issues. Please use a proper, trust chain validated certificate."];
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+#import <Security/Security.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SRSecurityPolicy : NSObject
+
+/**
+ A default `SRSecurityPolicy` implementation specifies socket security and
+ validates the certificate chain.
+
+ Use a subclass of `SRSecurityPolicy` for more fine grained customization.
+ */
++ (instancetype)defaultPolicy;
+
+/**
+ Specifies socket security and provider certificate pinning, disregarding certificate
+ chain validation.
+
+ @param pinnedCertificates Array of `SecCertificateRef` SSL certificates to use for validation.
+ */
++ (instancetype)pinnningPolicyWithCertificates:(NSArray *)pinnedCertificates
+ DEPRECATED_MSG_ATTRIBUTE("Using pinned certificates is neither secure nor supported in SocketRocket, "
+ "and leads to security issues. Please use a proper, trust chain validated certificate.");
+
+/**
+ Specifies socket security and optional certificate chain validation.
+
+ @param enabled Whether or not to validate the SSL certificate chain. If you
+ are considering using this method because your certificate was not issued by a
+ recognized certificate authority, consider using `pinningPolicyWithCertificates` instead.
+ */
+- (instancetype)initWithCertificateChainValidationEnabled:(BOOL)enabled
+ DEPRECATED_MSG_ATTRIBUTE("Disabling certificate chain validation is unsafe. "
+ "Please use a proper Certificate Authority to issue your TLS certificates.")
+ NS_DESIGNATED_INITIALIZER;
+
+/**
+ Updates all the security options for input and output streams, for example you
+ can set your socket security level here.
+
+ @param stream Stream to update the options in.
+ */
+- (void)updateSecurityOptionsInStream:(NSStream *)stream;
+
+/**
+ Whether or not the specified server trust should be accepted, based on the security policy.
+
+ This method should be used when responding to an authentication challenge from
+ a server. In the default implemenation, no further validation is done here, but
+ you're free to override it in a subclass. See `SRPinningSecurityPolicy.h` for
+ an example.
+
+ @param serverTrust The X.509 certificate trust of the server.
+ @param domain The domain of serverTrust.
+
+ @return Whether or not to trust the server.
+ */
+- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain;
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright (c) 2016-present, Facebook, Inc.
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRSecurityPolicy.h"
+#import "SRPinningSecurityPolicy.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+@interface SRSecurityPolicy ()
+
+@property (nonatomic, assign, readonly) BOOL certificateChainValidationEnabled;
+
+@end
+
+@implementation SRSecurityPolicy
+
++ (instancetype)defaultPolicy
+{
+ return [self new];
+}
+
++ (instancetype)pinnningPolicyWithCertificates:(NSArray *)pinnedCertificates
+{
+ [NSException raise:NSInvalidArgumentException
+ format:@"Using pinned certificates is neither secure nor supported in SocketRocket, "
+ "and leads to security issues. Please use a proper, trust chain validated certificate."];
+
+ return nil;
+}
+
+- (instancetype)initWithCertificateChainValidationEnabled:(BOOL)enabled
+{
+ self = [super init];
+ if (!self) { return self; }
+
+ _certificateChainValidationEnabled = enabled;
+
+ return self;
+}
+
+- (instancetype)init
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+
+ return [self initWithCertificateChainValidationEnabled:YES];
+
+#pragma clang diagnostic pop
+}
+
+- (void)updateSecurityOptionsInStream:(NSStream *)stream
+{
+ // Enforce TLS 1.2
+ [stream setProperty:(__bridge id)CFSTR("kCFStreamSocketSecurityLevelTLSv1_2") forKey:(__bridge id)kCFStreamPropertySocketSecurityLevel];
+
+ // Validate certificate chain for this stream if enabled.
+ NSDictionary<NSString *, id> *sslOptions = @{ (__bridge NSString *)kCFStreamSSLValidatesCertificateChain : @(self.certificateChainValidationEnabled) };
+ [stream setProperty:sslOptions forKey:(__bridge NSString *)kCFStreamPropertySSLSettings];
+}
+
+- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain
+{
+ // No further evaluation happens in the default policy.
+ return YES;
+}
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <Foundation/Foundation.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+typedef NS_ENUM(NSInteger, SRReadyState) {
+ SR_CONNECTING = 0,
+ SR_OPEN = 1,
+ SR_CLOSING = 2,
+ SR_CLOSED = 3,
+};
+
+typedef NS_ENUM(NSInteger, SRStatusCode) {
+ // 0-999: Reserved and not used.
+ SRStatusCodeNormal = 1000,
+ SRStatusCodeGoingAway = 1001,
+ SRStatusCodeProtocolError = 1002,
+ SRStatusCodeUnhandledType = 1003,
+ // 1004 reserved.
+ SRStatusNoStatusReceived = 1005,
+ SRStatusCodeAbnormal = 1006,
+ SRStatusCodeInvalidUTF8 = 1007,
+ SRStatusCodePolicyViolated = 1008,
+ SRStatusCodeMessageTooBig = 1009,
+ SRStatusCodeMissingExtension = 1010,
+ SRStatusCodeInternalError = 1011,
+ SRStatusCodeServiceRestart = 1012,
+ SRStatusCodeTryAgainLater = 1013,
+ // 1014: Reserved for future use by the WebSocket standard.
+ SRStatusCodeTLSHandshake = 1015,
+ // 1016-1999: Reserved for future use by the WebSocket standard.
+ // 2000-2999: Reserved for use by WebSocket extensions.
+ // 3000-3999: Available for use by libraries and frameworks. May not be used by applications. Available for registration at the IANA via first-come, first-serve.
+ // 4000-4999: Available for use by applications.
+};
+
+@class SRWebSocket;
+@class SRSecurityPolicy;
+
+/**
+ Error domain used for errors reported by SRWebSocket.
+ */
+extern NSString *const SRWebSocketErrorDomain;
+
+/**
+ Key used for HTTP status code if bad response was received from the server.
+ */
+extern NSString *const SRHTTPResponseErrorKey;
+
+@protocol SRWebSocketDelegate;
+
+///--------------------------------------
+#pragma mark - SRWebSocket
+///--------------------------------------
+
+/**
+ A `SRWebSocket` object lets you connect, send and receive data to a remote Web Socket.
+ */
+@interface SRWebSocket : NSObject <NSStreamDelegate>
+
+/**
+ The delegate of the web socket.
+
+ The web socket delegate is notified on all state changes that happen to the web socket.
+ */
+@property (nonatomic, weak) id <SRWebSocketDelegate> delegate;
+
+/**
+ A dispatch queue for scheduling the delegate calls. The queue doesn't need be a serial queue.
+
+ If `nil` and `delegateOperationQueue` is `nil`, the socket uses main queue for performing all delegate method calls.
+ */
+@property (nullable, nonatomic, strong) dispatch_queue_t delegateDispatchQueue;
+
+/**
+ An operation queue for scheduling the delegate calls.
+
+ If `nil` and `delegateOperationQueue` is `nil`, the socket uses main queue for performing all delegate method calls.
+ */
+@property (nullable, nonatomic, strong) NSOperationQueue *delegateOperationQueue;
+
+/**
+ Current ready state of the socket. Default: `SR_CONNECTING`.
+
+ This property is Key-Value Observable and fully thread-safe.
+ */
+@property (atomic, assign, readonly) SRReadyState readyState;
+
+/**
+ An instance of `NSURL` that this socket connects to.
+ */
+@property (nullable, nonatomic, strong, readonly) NSURL *url;
+
+/**
+ All HTTP headers that were received by socket or `nil` if none were received so far.
+ */
+@property (nullable, nonatomic, assign, readonly) CFHTTPMessageRef receivedHTTPHeaders;
+
+/**
+ Array of `NSHTTPCookie` cookies to apply to the connection.
+ */
+@property (nullable, nonatomic, copy) NSArray<NSHTTPCookie *> *requestCookies;
+
+/**
+ The negotiated web socket protocol or `nil` if handshake did not yet complete.
+ */
+@property (nullable, nonatomic, copy, readonly) NSString *protocol;
+
+/**
+ A boolean value indicating whether this socket will allow connection without SSL trust chain evaluation.
+ For DEBUG builds this flag is ignored, and SSL connections are allowed regardless of the certificate trust configuration
+ */
+@property (nonatomic, assign, readonly) BOOL allowsUntrustedSSLCertificates;
+
+///--------------------------------------
+#pragma mark - Constructors
+///--------------------------------------
+
+/**
+ Initializes a web socket with a given `NSURLRequest`.
+
+ @param request Request to initialize with.
+ */
+- (instancetype)initWithURLRequest:(NSURLRequest *)request;
+
+/**
+ Initializes a web socket with a given `NSURLRequest`, specifying a transport security policy (e.g. SSL configuration).
+
+ @param request Request to initialize with.
+ @param securityPolicy Policy object describing transport security behavior.
+ */
+- (instancetype)initWithURLRequest:(NSURLRequest *)request securityPolicy:(SRSecurityPolicy *)securityPolicy;
+
+/**
+ Initializes a web socket with a given `NSURLRequest` and list of sub-protocols.
+
+ @param request Request to initialize with.
+ @param protocols An array of strings that turn into `Sec-WebSocket-Protocol`. Default: `nil`.
+ */
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(nullable NSArray<NSString *> *)protocols;
+
+/**
+ Initializes a web socket with a given `NSURLRequest`, list of sub-protocols and whether untrusted SSL certificates are allowed.
+
+ @param request Request to initialize with.
+ @param protocols An array of strings that turn into `Sec-WebSocket-Protocol`. Default: `nil`.
+ @param allowsUntrustedSSLCertificates Boolean value indicating whether untrusted SSL certificates are allowed. Default: `false`.
+ */
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(nullable NSArray<NSString *> *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates
+ DEPRECATED_MSG_ATTRIBUTE("Disabling certificate chain validation is unsafe. "
+ "Please use a proper Certificate Authority to issue your TLS certificates.");
+
+/**
+ Initializes a web socket with a given `NSURLRequest`, list of sub-protocols and whether untrusted SSL certificates are allowed.
+
+ @param request Request to initialize with.
+ @param protocols An array of strings that turn into `Sec-WebSocket-Protocol`. Default: `nil`.
+ @param securityPolicy Policy object describing transport security behavior.
+ */
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(nullable NSArray<NSString *> *)protocols securityPolicy:(SRSecurityPolicy *)securityPolicy NS_DESIGNATED_INITIALIZER;
+
+/**
+ Initializes a web socket with a given `NSURL`.
+
+ @param url URL to initialize with.
+ */
+- (instancetype)initWithURL:(NSURL *)url;
+
+/**
+ Initializes a web socket with a given `NSURL` and list of sub-protocols.
+
+ @param url URL to initialize with.
+ @param protocols An array of strings that turn into `Sec-WebSocket-Protocol`. Default: `nil`.
+ */
+- (instancetype)initWithURL:(NSURL *)url protocols:(nullable NSArray<NSString *> *)protocols;
+
+/**
+ Initializes a web socket with a given `NSURL`, specifying a transport security policy (e.g. SSL configuration).
+
+ @param url URL to initialize with.
+ @param securityPolicy Policy object describing transport security behavior.
+ */
+- (instancetype)initWithURL:(NSURL *)url securityPolicy:(SRSecurityPolicy *)securityPolicy;
+
+/**
+ Initializes a web socket with a given `NSURL`, list of sub-protocols and whether untrusted SSL certificates are allowed.
+
+ @param url URL to initialize with.
+ @param protocols An array of strings that turn into `Sec-WebSocket-Protocol`. Default: `nil`.
+ @param allowsUntrustedSSLCertificates Boolean value indicating whether untrusted SSL certificates are allowed. Default: `false`.
+ */
+- (instancetype)initWithURL:(NSURL *)url protocols:(nullable NSArray<NSString *> *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates
+ DEPRECATED_MSG_ATTRIBUTE("Disabling certificate chain validation is unsafe. "
+ "Please use a proper Certificate Authority to issue your TLS certificates.");
+
+/**
+ Unavailable initializer. Please use any other initializer.
+ */
+- (instancetype)init NS_UNAVAILABLE;
+
+/**
+ Unavailable constructor. Please use any other initializer.
+ */
++ (instancetype)new NS_UNAVAILABLE;
+
+///--------------------------------------
+#pragma mark - Schedule
+///--------------------------------------
+
+/**
+ Schedules a received on a given run loop in a given mode.
+ By default, a web socket will schedule itself on `+[NSRunLoop SR_networkRunLoop]` using `NSDefaultRunLoopMode`.
+
+ @param runLoop The run loop on which to schedule the receiver.
+ @param mode The mode for the run loop.
+ */
+- (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_NAME(schedule(in:forMode:));
+
+/**
+ Removes the receiver from a given run loop running in a given mode.
+
+ @param runLoop The run loop on which the receiver was scheduled.
+ @param mode The mode for the run loop.
+ */
+- (void)unscheduleFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode NS_SWIFT_NAME(unschedule(from:forMode:));
+
+///--------------------------------------
+#pragma mark - Open / Close
+///--------------------------------------
+
+/**
+ Opens web socket, which will trigger connection, authentication and start receiving/sending events.
+ An instance of `SRWebSocket` is intended for one-time-use only. This method should be called once and only once.
+ */
+- (void)open;
+
+/**
+ Closes a web socket using `SRStatusCodeNormal` code and no reason.
+ */
+- (void)close;
+
+/**
+ Closes a web socket using a given code and reason.
+
+ @param code Code to close the socket with.
+ @param reason Reason to send to the server or `nil`.
+ */
+- (void)closeWithCode:(NSInteger)code reason:(nullable NSString *)reason;
+
+///--------------------------------------
+#pragma mark Send
+///--------------------------------------
+
+/**
+ Send a UTF-8 string or binary data to the server.
+
+ @param message UTF-8 String or Data to send.
+
+ @deprecated Please use `sendString:` or `sendData` instead.
+ */
+- (void)send:(nullable id)message __attribute__((deprecated("Please use `sendString:error:` or `sendData:error:` instead.")));
+
+/**
+ Send a UTF-8 String to the server.
+
+ @param string String to send.
+ @param error On input, a pointer to variable for an `NSError` object.
+ If an error occurs, this pointer is set to an `NSError` object containing information about the error.
+ You may specify `nil` to ignore the error information.
+
+ @return `YES` if the string was scheduled to send, otherwise - `NO`.
+ */
+- (BOOL)sendString:(NSString *)string error:(NSError **)error NS_SWIFT_NAME(send(string:));
+
+/**
+ Send binary data to the server.
+
+ @param data Data to send.
+ @param error On input, a pointer to variable for an `NSError` object.
+ If an error occurs, this pointer is set to an `NSError` object containing information about the error.
+ You may specify `nil` to ignore the error information.
+
+ @return `YES` if the string was scheduled to send, otherwise - `NO`.
+ */
+- (BOOL)sendData:(nullable NSData *)data error:(NSError **)error NS_SWIFT_NAME(send(data:));
+
+/**
+ Send binary data to the server, without making a defensive copy of it first.
+
+ @param data Data to send.
+ @param error On input, a pointer to variable for an `NSError` object.
+ If an error occurs, this pointer is set to an `NSError` object containing information about the error.
+ You may specify `nil` to ignore the error information.
+
+ @return `YES` if the string was scheduled to send, otherwise - `NO`.
+ */
+- (BOOL)sendDataNoCopy:(nullable NSData *)data error:(NSError **)error NS_SWIFT_NAME(send(dataNoCopy:));
+
+/**
+ Send Ping message to the server with optional data.
+
+ @param data Instance of `NSData` or `nil`.
+ @param error On input, a pointer to variable for an `NSError` object.
+ If an error occurs, this pointer is set to an `NSError` object containing information about the error.
+ You may specify `nil` to ignore the error information.
+
+ @return `YES` if the string was scheduled to send, otherwise - `NO`.
+ */
+- (BOOL)sendPing:(nullable NSData *)data error:(NSError **)error NS_SWIFT_NAME(sendPing(_:));
+
+@end
+
+///--------------------------------------
+#pragma mark - SRWebSocketDelegate
+///--------------------------------------
+
+/**
+ The `SRWebSocketDelegate` protocol describes the methods that `SRWebSocket` objects
+ call on their delegates to handle status and messsage events.
+ */
+@protocol SRWebSocketDelegate <NSObject>
+
+@optional
+
+#pragma mark Receive Messages
+
+/**
+ Called when any message was received from a web socket.
+ This method is suboptimal and might be deprecated in a future release.
+
+ @param webSocket An instance of `SRWebSocket` that received a message.
+ @param message Received message. Either a `String` or `NSData`.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessage:(id)message;
+
+/**
+ Called when a frame was received from a web socket.
+
+ @param webSocket An instance of `SRWebSocket` that received a message.
+ @param string Received text in a form of UTF-8 `String`.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithString:(NSString *)string;
+
+/**
+ Called when a frame was received from a web socket.
+
+ @param webSocket An instance of `SRWebSocket` that received a message.
+ @param data Received data in a form of `NSData`.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didReceiveMessageWithData:(NSData *)data;
+
+#pragma mark Status & Connection
+
+/**
+ Called when a given web socket was open and authenticated.
+
+ @param webSocket An instance of `SRWebSocket` that was open.
+ */
+- (void)webSocketDidOpen:(SRWebSocket *)webSocket;
+
+/**
+ Called when a given web socket encountered an error.
+
+ @param webSocket An instance of `SRWebSocket` that failed with an error.
+ @param error An instance of `NSError`.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didFailWithError:(NSError *)error;
+
+/**
+ Called when a given web socket was closed.
+
+ @param webSocket An instance of `SRWebSocket` that was closed.
+ @param code Code reported by the server.
+ @param reason Reason in a form of a String that was reported by the server or `nil`.
+ @param wasClean Boolean value indicating whether a socket was closed in a clean state.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didCloseWithCode:(NSInteger)code reason:(nullable NSString *)reason wasClean:(BOOL)wasClean;
+
+/**
+ Called on receive of a ping message from the server.
+
+ @param webSocket An instance of `SRWebSocket` that received a ping frame.
+ @param data Payload that was received or `nil` if there was no payload.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didReceivePingWithData:(nullable NSData *)data;
+
+/**
+ Called when a pong data was received in response to ping.
+
+ @param webSocket An instance of `SRWebSocket` that received a pong frame.
+ @param pongData Payload that was received or `nil` if there was no payload.
+ */
+- (void)webSocket:(SRWebSocket *)webSocket didReceivePong:(nullable NSData *)pongData;
+
+/**
+ Sent before reporting a text frame to be able to configure if it shuold be convert to a UTF-8 String or passed as `NSData`.
+ If the method is not implemented - it will always convert text frames to String.
+
+ @param webSocket An instance of `SRWebSocket` that received a text frame.
+
+ @return `YES` if text frame should be converted to UTF-8 String, otherwise - `NO`. Default: `YES`.
+ */
+- (BOOL)webSocketShouldConvertTextFrameToString:(SRWebSocket *)webSocket NS_SWIFT_NAME(webSocketShouldConvertTextFrameToString(_:));
+
+@end
+
+NS_ASSUME_NONNULL_END
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import "SRWebSocket.h"
+
+#if __has_include(<unicode/utf8.h>)
+#define HAS_ICU
+#endif
+
+#ifdef HAS_ICU
+#import <unicode/utf8.h>
+#endif
+
+#import <os/lock.h>
+
+#import "SRDelegateController.h"
+#import "SRIOConsumer.h"
+#import "SRIOConsumerPool.h"
+#import "SRHash.h"
+#import "SRURLUtilities.h"
+#import "SRError.h"
+#import "NSURLRequest+SRWebSocket.h"
+#import "NSRunLoop+SRWebSocket.h"
+#import "SRProxyConnect.h"
+#import "SRSecurityPolicy.h"
+#import "SRHTTPConnectMessage.h"
+#import "SRRandom.h"
+#import "SRLog.h"
+#import "SRMutex.h"
+#import "SRSIMDHelpers.h"
+#import "NSURLRequest+SRWebSocketPrivate.h"
+#import "NSRunLoop+SRWebSocketPrivate.h"
+#import "SRConstants.h"
+
+#if !__has_feature(objc_arc)
+#error SocketRocket must be compiled with ARC enabled
+#endif
+
+__attribute__((used)) static void importCategories(void)
+{
+ import_NSURLRequest_SRWebSocket();
+ import_NSRunLoop_SRWebSocket();
+}
+
+typedef struct {
+ BOOL fin;
+ // BOOL rsv1;
+ // BOOL rsv2;
+ // BOOL rsv3;
+ uint8_t opcode;
+ BOOL masked;
+ uint64_t payload_length;
+} frame_header;
+
+static NSString *const SRWebSocketAppendToSecKeyString = @"258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
+
+static inline int32_t validate_dispatch_data_partial_string(NSData *data);
+
+static uint8_t const SRWebSocketProtocolVersion = 13;
+
+NSString *const SRWebSocketErrorDomain = @"SRWebSocketErrorDomain";
+NSString *const SRHTTPResponseErrorKey = @"HTTPResponseStatusCode";
+
+@interface SRWebSocket () <NSStreamDelegate>
+
+@property (atomic, assign, readwrite) SRReadyState readyState;
+
+// Specifies whether SSL trust chain should NOT be evaluated.
+// By default this flag is set to NO, meaning only secure SSL connections are allowed.
+// For DEBUG builds this flag is ignored, and SSL connections are allowed regardless
+// of the certificate trust configuration
+@property (nonatomic, assign, readwrite) BOOL allowsUntrustedSSLCertificates;
+
+@property (nonatomic, strong, readonly) SRDelegateController *delegateController;
+
+@end
+
+@implementation SRWebSocket {
+ SRMutex _kvoLock;
+ os_unfair_lock _propertyLock;
+
+ dispatch_queue_t _workQueue;
+ NSMutableArray<SRIOConsumer *> *_consumers;
+
+ NSInputStream *_inputStream;
+ NSOutputStream *_outputStream;
+
+ dispatch_data_t _readBuffer;
+ NSUInteger _readBufferOffset;
+
+ dispatch_data_t _outputBuffer;
+ NSUInteger _outputBufferOffset;
+
+ uint8_t _currentFrameOpcode;
+ size_t _currentFrameCount;
+ size_t _readOpCount;
+ uint32_t _currentStringScanPosition;
+ NSMutableData *_currentFrameData;
+
+ NSString *_closeReason;
+
+ NSString *_secKey;
+
+ SRSecurityPolicy *_securityPolicy;
+ BOOL _requestRequiresSSL;
+ BOOL _streamSecurityValidated;
+
+ uint8_t _currentReadMaskKey[4];
+ size_t _currentReadMaskOffset;
+
+ BOOL _closeWhenFinishedWriting;
+ BOOL _failed;
+
+ NSURLRequest *_urlRequest;
+
+ BOOL _sentClose;
+ BOOL _didFail;
+ BOOL _cleanupScheduled;
+ int _closeCode;
+
+ BOOL _isPumping;
+
+ NSMutableSet<NSArray *> *_scheduledRunloops; // Set<[RunLoop, Mode]>. TODO: (nlutsenko) Fix clowntown
+
+ // We use this to retain ourselves.
+ __strong SRWebSocket *_selfRetain;
+
+ NSArray<NSString *> *_requestedProtocols;
+ SRIOConsumerPool *_consumerPool;
+
+ // proxy support
+ SRProxyConnect *_proxyConnect;
+}
+
+@synthesize readyState = _readyState;
+
+///--------------------------------------
+#pragma mark - Init
+///--------------------------------------
+
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NSString *> *)protocols securityPolicy:(SRSecurityPolicy *)securityPolicy
+{
+ self = [super init];
+ if (!self) return self;
+
+ assert(request.URL);
+ _url = request.URL;
+ _urlRequest = request;
+ _requestedProtocols = [protocols copy];
+ _securityPolicy = securityPolicy;
+ _requestRequiresSSL = SRURLRequiresSSL(_url);
+
+ _readyState = SR_CONNECTING;
+
+ _propertyLock = OS_UNFAIR_LOCK_INIT;
+ _kvoLock = SRMutexInitRecursive();
+ _workQueue = dispatch_queue_create(NULL, DISPATCH_QUEUE_SERIAL);
+
+ // Going to set a specific on the queue so we can validate we're on the work queue
+ dispatch_queue_set_specific(_workQueue, (__bridge void *)self, (__bridge void *)(_workQueue), NULL);
+
+ _delegateController = [[SRDelegateController alloc] init];
+
+ _readBuffer = dispatch_data_empty;
+ _outputBuffer = dispatch_data_empty;
+
+ _currentFrameData = [[NSMutableData alloc] init];
+
+ _consumers = [[NSMutableArray alloc] init];
+
+ _consumerPool = [[SRIOConsumerPool alloc] init];
+
+ _scheduledRunloops = [[NSMutableSet alloc] init];
+
+ return self;
+}
+
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NSString *> *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates
+{
+ SRSecurityPolicy *securityPolicy;
+ NSArray *pinnedCertificates = request.SR_SSLPinnedCertificates;
+ if (pinnedCertificates) {
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ securityPolicy = [SRSecurityPolicy pinnningPolicyWithCertificates:pinnedCertificates];
+#pragma clang diagnostic pop
+ } else {
+ BOOL certificateChainValidationEnabled = !allowsUntrustedSSLCertificates;
+ securityPolicy = [[SRSecurityPolicy alloc] initWithCertificateChainValidationEnabled:certificateChainValidationEnabled];
+ }
+
+ return [self initWithURLRequest:request protocols:protocols securityPolicy:securityPolicy];
+}
+
+- (instancetype)initWithURLRequest:(NSURLRequest *)request securityPolicy:(SRSecurityPolicy *)securityPolicy
+{
+ return [self initWithURLRequest:request protocols:nil securityPolicy:securityPolicy];
+}
+
+- (instancetype)initWithURLRequest:(NSURLRequest *)request protocols:(NSArray<NSString *> *)protocols
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ return [self initWithURLRequest:request protocols:protocols allowsUntrustedSSLCertificates:NO];
+#pragma clang diagnostic pop
+}
+
+- (instancetype)initWithURLRequest:(NSURLRequest *)request
+{
+ return [self initWithURLRequest:request protocols:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url
+{
+ return [self initWithURL:url protocols:nil];
+}
+
+- (instancetype)initWithURL:(NSURL *)url protocols:(NSArray<NSString *> *)protocols
+{
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated"
+ return [self initWithURL:url protocols:protocols allowsUntrustedSSLCertificates:NO];
+#pragma clang diagnostic pop
+}
+
+- (instancetype)initWithURL:(NSURL *)url securityPolicy:(SRSecurityPolicy *)securityPolicy
+{
+ NSURLRequest *request = [NSURLRequest requestWithURL:url];
+ return [self initWithURLRequest:request protocols:nil securityPolicy:securityPolicy];
+}
+
+- (instancetype)initWithURL:(NSURL *)url protocols:(NSArray<NSString *> *)protocols allowsUntrustedSSLCertificates:(BOOL)allowsUntrustedSSLCertificates
+{
+ NSURLRequest *request = [NSURLRequest requestWithURL:url];
+ return [self initWithURLRequest:request protocols:protocols allowsUntrustedSSLCertificates:allowsUntrustedSSLCertificates];
+}
+
+- (void)assertOnWorkQueue
+{
+ assert(dispatch_get_specific((__bridge void *)self) == (__bridge void *)_workQueue);
+}
+
+///--------------------------------------
+#pragma mark - Dealloc
+///--------------------------------------
+
+- (void)dealloc
+{
+ _inputStream.delegate = nil;
+ _outputStream.delegate = nil;
+
+ [_inputStream close];
+ [_outputStream close];
+
+ if (_receivedHTTPHeaders) {
+ CFRelease(_receivedHTTPHeaders);
+ _receivedHTTPHeaders = NULL;
+ }
+
+ SRMutexDestroy(_kvoLock);
+}
+
+///--------------------------------------
+#pragma mark - Accessors
+///--------------------------------------
+
+#pragma mark readyState
+
+- (void)setReadyState:(SRReadyState)readyState
+{
+ @try {
+ SRMutexLock(_kvoLock);
+ if (_readyState != readyState) {
+ [self willChangeValueForKey:@"readyState"];
+ os_unfair_lock_lock(&_propertyLock);
+ _readyState = readyState;
+ os_unfair_lock_unlock(&_propertyLock);
+ [self didChangeValueForKey:@"readyState"];
+ }
+ }
+ @finally {
+ SRMutexUnlock(_kvoLock);
+ }
+}
+
+- (SRReadyState)readyState
+{
+ SRReadyState state = 0;
+ os_unfair_lock_lock(&_propertyLock);
+ state = _readyState;
+ os_unfair_lock_unlock(&_propertyLock);
+ return state;
+}
+
++ (BOOL)automaticallyNotifiesObserversOfReadyState {
+ return NO;
+}
+
+///--------------------------------------
+#pragma mark - Open / Close
+///--------------------------------------
+
+- (void)open
+{
+ NSURL* const url = _url;
+ if (!url) {
+ NSError *error = SRErrorWithDomainCodeDescription(NSURLErrorDomain, NSURLErrorBadURL, @"Unable to open socket with emtpy URL.");
+ [self _failWithError:error];
+ return;
+ }
+ NSAssert(self.readyState == SR_CONNECTING, @"Cannot call -(void)open on SRWebSocket more than once.");
+
+ _selfRetain = self;
+
+ if (_urlRequest.timeoutInterval > 0) {
+ dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(_urlRequest.timeoutInterval * NSEC_PER_SEC));
+ __weak typeof(self) wself = self;
+ dispatch_after(popTime, dispatch_get_main_queue(), ^{
+ __strong SRWebSocket *sself = wself;
+ if (!sself) {
+ return;
+ }
+ if (sself.readyState == SR_CONNECTING) {
+ NSError *error = SRErrorWithDomainCodeDescription(NSURLErrorDomain, NSURLErrorTimedOut, @"Timed out connecting to server.");
+ [sself _failWithError:error];
+ }
+ });
+ }
+
+ _proxyConnect = [[SRProxyConnect alloc] initWithURL:url];
+
+ __weak typeof(self) wself = self;
+ [_proxyConnect openNetworkStreamWithCompletion:^(NSError *error, NSInputStream *readStream, NSOutputStream *writeStream) {
+ [wself _connectionDoneWithError:error readStream:readStream writeStream:writeStream];
+ }];
+}
+
+- (void)_connectionDoneWithError:(NSError *)error readStream:(NSInputStream *)readStream writeStream:(NSOutputStream *)writeStream
+{
+ if (error != nil) {
+ [self _failWithError:error];
+ } else {
+ _outputStream = writeStream;
+ _inputStream = readStream;
+
+ _inputStream.delegate = self;
+ _outputStream.delegate = self;
+ [self _updateSecureStreamOptions];
+
+ if (!_scheduledRunloops.count) {
+ [self scheduleInRunLoop:[NSRunLoop SR_networkRunLoop] forMode:NSDefaultRunLoopMode];
+ }
+
+ // If we don't require SSL validation - consider that we connected.
+ // Otherwise `didConnect` is called when SSL validation finishes.
+ if (!_requestRequiresSSL) {
+ dispatch_async(_workQueue, ^{
+ [self didConnect];
+ });
+ }
+ }
+ // Schedule to run on a work queue, to make sure we don't run this inline and deallocate `self` inside `SRProxyConnect`.
+ // TODO: (nlutsenko) Find a better structure for this, maybe Bolts Tasks?
+ dispatch_async(_workQueue, ^{
+ self->_proxyConnect = nil;
+ });
+}
+
+- (BOOL)_checkHandshake:(CFHTTPMessageRef)httpMessage
+{
+ NSString *acceptHeader = CFBridgingRelease(CFHTTPMessageCopyHeaderFieldValue(httpMessage, CFSTR("Sec-WebSocket-Accept")));
+
+ if (acceptHeader == nil) {
+ return NO;
+ }
+
+ NSString *concattedString = [_secKey stringByAppendingString:SRWebSocketAppendToSecKeyString];
+ NSData *hashedString = SRSHA1HashFromString(concattedString);
+ NSString *expectedAccept = SRBase64EncodedStringFromData(hashedString);
+ return [acceptHeader isEqualToString:expectedAccept];
+}
+
+- (void)_HTTPHeadersDidFinish:(CFHTTPMessageRef)httpMessage
+{
+ NSInteger responseCode = CFHTTPMessageGetResponseStatusCode(httpMessage);
+ if (responseCode >= 400) {
+ SRDebugLog(@"Request failed with response code %d", responseCode);
+ NSError *error = SRHTTPErrorWithCodeDescription(responseCode, 2132,
+ [NSString stringWithFormat:@"Received bad response code from server: %d.",
+ (int)responseCode]);
+ [self _failWithError:error];
+ return;
+ }
+
+ if(![self _checkHandshake:httpMessage]) {
+ NSError *error = SRErrorWithCodeDescription(2133, @"Invalid Sec-WebSocket-Accept response.");
+ [self _failWithError:error];
+ return;
+ }
+
+ NSString *negotiatedProtocol = CFBridgingRelease(CFHTTPMessageCopyHeaderFieldValue(httpMessage, CFSTR("Sec-WebSocket-Protocol")));
+ if (negotiatedProtocol) {
+ // Make sure we requested the protocol
+ if ([_requestedProtocols indexOfObject:negotiatedProtocol] == NSNotFound) {
+ NSError *error = SRErrorWithCodeDescription(2133, @"Server specified Sec-WebSocket-Protocol that wasn't requested.");
+ [self _failWithError:error];
+ return;
+ }
+
+ _protocol = negotiatedProtocol;
+ }
+
+ self.readyState = SR_OPEN;
+
+ if (!_didFail) {
+ [self _readFrameNew];
+ }
+
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didOpen) {
+ [delegate webSocketDidOpen:self];
+ }
+ }];
+}
+
+
+- (void)_readHTTPHeader
+{
+ if (_receivedHTTPHeaders == NULL) {
+ _receivedHTTPHeaders = CFHTTPMessageCreateEmpty(NULL, NO);
+ }
+
+ [self _readUntilHeaderCompleteWithCallback:^(SRWebSocket *socket, NSData *data) {
+ if (!socket) {
+ return;
+ }
+ CFHTTPMessageRef receivedHTTPHeaders = socket->_receivedHTTPHeaders;
+
+ CFHTTPMessageAppendBytes(receivedHTTPHeaders, (const UInt8 *)data.bytes, data.length);
+
+ if (CFHTTPMessageIsHeaderComplete(receivedHTTPHeaders)) {
+ SRDebugLog(@"Finished reading headers %@", CFBridgingRelease(CFHTTPMessageCopyAllHeaderFields(receivedHTTPHeaders)));
+ [socket _HTTPHeadersDidFinish:receivedHTTPHeaders];
+ } else {
+ [socket _readHTTPHeader];
+ }
+ }];
+}
+
+- (void)didConnect
+{
+ SRDebugLog(@"Connected");
+
+ _secKey = SRBase64EncodedStringFromData(SRRandomData(16));
+ assert([_secKey length] == 24);
+
+ CFHTTPMessageRef message = SRHTTPConnectMessageCreate(_urlRequest,
+ _secKey,
+ SRWebSocketProtocolVersion,
+ self.requestCookies,
+ _requestedProtocols);
+
+ NSData *messageData = CFBridgingRelease(CFHTTPMessageCopySerializedMessage(message));
+
+ CFRelease(message);
+
+ [self _writeData:messageData];
+ [self _readHTTPHeader];
+}
+
+- (void)_updateSecureStreamOptions
+{
+ if (_requestRequiresSSL) {
+ SRDebugLog(@"Setting up security for streams.");
+ [_securityPolicy updateSecurityOptionsInStream:_inputStream];
+ [_securityPolicy updateSecurityOptionsInStream:_outputStream];
+ }
+
+ NSString *networkServiceType = SRStreamNetworkServiceTypeFromURLRequest(_urlRequest);
+ if (networkServiceType != nil) {
+ [_inputStream setProperty:networkServiceType forKey:NSStreamNetworkServiceType];
+ [_outputStream setProperty:networkServiceType forKey:NSStreamNetworkServiceType];
+ }
+}
+
+- (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode
+{
+ [_outputStream scheduleInRunLoop:aRunLoop forMode:mode];
+ [_inputStream scheduleInRunLoop:aRunLoop forMode:mode];
+
+ [_scheduledRunloops addObject:@[aRunLoop, mode]];
+}
+
+- (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode
+{
+ [_outputStream removeFromRunLoop:aRunLoop forMode:mode];
+ [_inputStream removeFromRunLoop:aRunLoop forMode:mode];
+
+ [_scheduledRunloops removeObject:@[aRunLoop, mode]];
+}
+
+- (void)close
+{
+ [self closeWithCode:SRStatusCodeNormal reason:nil];
+}
+
+- (void)closeWithCode:(NSInteger)code reason:(NSString *)reason
+{
+ assert(code);
+ __weak typeof(self) wself = self;
+ dispatch_async(_workQueue, ^{
+ __strong SRWebSocket *sself = wself;
+ if (!sself) {
+ return;
+ }
+ if (sself.readyState == SR_CLOSING || sself.readyState == SR_CLOSED) {
+ return;
+ }
+
+ BOOL wasConnecting = sself.readyState == SR_CONNECTING;
+
+ sself.readyState = SR_CLOSING;
+
+ SRDebugLog(@"Closing with code %d reason %@", code, reason);
+
+ if (wasConnecting) {
+ [sself closeConnection];
+ return;
+ }
+
+ size_t maxMsgSize = [reason maximumLengthOfBytesUsingEncoding:NSUTF8StringEncoding];
+ NSMutableData *mutablePayload = [[NSMutableData alloc] initWithLength:sizeof(uint16_t) + maxMsgSize];
+ NSData *payload = mutablePayload;
+
+ ((uint16_t *)mutablePayload.mutableBytes)[0] = CFSwapInt16BigToHost((uint16_t)code);
+
+ if (reason) {
+ NSRange remainingRange = {0};
+
+ NSUInteger usedLength = 0;
+
+ BOOL success = [reason getBytes:(char *)mutablePayload.mutableBytes + sizeof(uint16_t) maxLength:payload.length - sizeof(uint16_t) usedLength:&usedLength encoding:NSUTF8StringEncoding options:NSStringEncodingConversionExternalRepresentation range:NSMakeRange(0, reason.length) remainingRange:&remainingRange];
+#pragma unused (success)
+
+ assert(success);
+ assert(remainingRange.length == 0);
+
+ if (usedLength != maxMsgSize) {
+ payload = [payload subdataWithRange:NSMakeRange(0, usedLength + sizeof(uint16_t))];
+ }
+ }
+
+
+ [sself _sendFrameWithOpcode:SROpCodeConnectionClose data:payload];
+ });
+}
+
+- (void)_closeWithProtocolError:(NSString *)message
+{
+ // Need to shunt this on the _callbackQueue first to see if they received any messages
+ [self.delegateController performDelegateQueueBlock:^{
+ [self closeWithCode:SRStatusCodeProtocolError reason:message];
+ dispatch_async(self->_workQueue, ^{
+ [self closeConnection];
+ });
+ }];
+}
+
+- (void)_failWithError:(NSError *)error
+{
+ dispatch_async(_workQueue, ^{
+ if (self.readyState != SR_CLOSED) {
+ self->_failed = YES;
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didFailWithError) {
+ [delegate webSocket:self didFailWithError:error];
+ }
+ }];
+
+ self.readyState = SR_CLOSED;
+
+ SRDebugLog(@"Failing with error %@", error.localizedDescription);
+
+ [self closeConnection];
+ [self _scheduleCleanup];
+ }
+ });
+}
+
+- (void)_writeData:(NSData *)data
+{
+ [self assertOnWorkQueue];
+
+ if (_closeWhenFinishedWriting) {
+ return;
+ }
+
+ __block NSData *strongData = data;
+ dispatch_data_t newData = dispatch_data_create(data.bytes, data.length, nil, ^{
+ strongData = nil;
+ });
+ (void)strongData;
+ _outputBuffer = dispatch_data_create_concat(_outputBuffer, newData);
+ [self _pumpWriting];
+}
+
+- (void)send:(nullable id)message
+{
+ if (!message) {
+ [self sendData:nil error:nil]; // Send Data, but it doesn't matter since we are going to send the same text frame with 0 length.
+ } else if ([message isKindOfClass:[NSString class]]) {
+ [self sendString:(NSString *_Nonnull)message error:nil];
+ } else if ([message isKindOfClass:[NSData class]]) {
+ [self sendData:message error:nil];
+ } else {
+ NSAssert(NO, @"Unrecognized message. Not able to send anything other than a String or NSData.");
+ }
+}
+
+- (BOOL)sendString:(NSString *)string error:(NSError **)error
+{
+ if (self.readyState != SR_OPEN) {
+ NSString *message = @"Invalid State: Cannot call `sendString:error:` until connection is open.";
+ if (error) {
+ *error = SRErrorWithCodeDescription(2134, message);
+ }
+ SRDebugLog(message);
+ return NO;
+ }
+
+ string = [string copy];
+ dispatch_async(_workQueue, ^{
+ [self _sendFrameWithOpcode:SROpCodeTextFrame data:[string dataUsingEncoding:NSUTF8StringEncoding]];
+ });
+ return YES;
+}
+
+- (BOOL)sendData:(nullable NSData *)data error:(NSError **)error
+{
+ data = [data copy];
+ return [self sendDataNoCopy:data error:error];
+}
+
+- (BOOL)sendDataNoCopy:(nullable NSData *)data error:(NSError **)error
+{
+ if (self.readyState != SR_OPEN) {
+ NSString *message = @"Invalid State: Cannot call `sendDataNoCopy:error:` until connection is open.";
+ if (error) {
+ *error = SRErrorWithCodeDescription(2134, message);
+ }
+ SRDebugLog(message);
+ return NO;
+ }
+
+ dispatch_async(_workQueue, ^{
+ if (data) {
+ [self _sendFrameWithOpcode:SROpCodeBinaryFrame data:data];
+ } else {
+ [self _sendFrameWithOpcode:SROpCodeTextFrame data:nil];
+ }
+ });
+ return YES;
+}
+
+- (BOOL)sendPing:(nullable NSData *)data error:(NSError **)error
+{
+ if (self.readyState != SR_OPEN) {
+ NSString *message = @"Invalid State: Cannot call `sendPing:error:` until connection is open.";
+ if (error) {
+ *error = SRErrorWithCodeDescription(2134, message);
+ }
+ SRDebugLog(message);
+ return NO;
+ }
+
+ data = [data copy] ?: [NSData data]; // It's okay for a ping to be empty
+ dispatch_async(_workQueue, ^{
+ [self _sendFrameWithOpcode:SROpCodePing data:data];
+ });
+ return YES;
+}
+
+- (void)_handlePingWithData:(nullable NSData *)data
+{
+ // Need to pingpong this off _callbackQueue first to make sure messages happen in order
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didReceivePing) {
+ [delegate webSocket:self didReceivePingWithData:data];
+ }
+ dispatch_async(self->_workQueue, ^{
+ [self _sendFrameWithOpcode:SROpCodePong data:data];
+ });
+ }];
+}
+
+- (void)handlePong:(NSData *)pongData
+{
+ SRDebugLog(@"Received pong");
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didReceivePong) {
+ [delegate webSocket:self didReceivePong:pongData];
+ }
+ }];
+}
+
+
+static inline BOOL closeCodeIsValid(int closeCode) {
+ if (closeCode < 1000) {
+ return NO;
+ }
+
+ if (closeCode >= 1000 && closeCode <= 1011) {
+ if (closeCode == 1004 ||
+ closeCode == 1005 ||
+ closeCode == 1006) {
+ return NO;
+ }
+ return YES;
+ }
+
+ if (closeCode >= 3000 && closeCode <= 3999) {
+ return YES;
+ }
+
+ if (closeCode >= 4000 && closeCode <= 4999) {
+ return YES;
+ }
+
+ return NO;
+}
+
+// Note from RFC:
+//
+// If there is a body, the first two
+// bytes of the body MUST be a 2-byte unsigned integer (in network byte
+// order) representing a status code with value /code/ defined in
+// Section 7.4. Following the 2-byte integer the body MAY contain UTF-8
+// encoded data with value /reason/, the interpretation of which is not
+// defined by this specification.
+
+- (void)handleCloseWithData:(NSData *)data
+{
+ size_t dataSize = data.length;
+ __block uint16_t closeCode = 0;
+
+ SRDebugLog(@"Received close frame");
+
+ if (dataSize == 1) {
+ // TODO handle error
+ [self _closeWithProtocolError:@"Payload for close must be larger than 2 bytes"];
+ return;
+ } else if (dataSize >= 2) {
+ [data getBytes:&closeCode length:sizeof(closeCode)];
+ _closeCode = CFSwapInt16BigToHost(closeCode);
+ if (!closeCodeIsValid(_closeCode)) {
+ [self _closeWithProtocolError:[NSString stringWithFormat:@"Cannot have close code of %d", _closeCode]];
+ return;
+ }
+ if (dataSize > 2) {
+ _closeReason = [[NSString alloc] initWithData:[data subdataWithRange:NSMakeRange(2, dataSize - 2)] encoding:NSUTF8StringEncoding];
+ if (!_closeReason) {
+ [self _closeWithProtocolError:@"Close reason MUST be valid UTF-8"];
+ return;
+ }
+ }
+ } else {
+ _closeCode = SRStatusNoStatusReceived;
+ }
+
+ [self assertOnWorkQueue];
+
+ if (self.readyState == SR_OPEN) {
+ [self closeWithCode:1000 reason:nil];
+ }
+ dispatch_async(_workQueue, ^{
+ [self closeConnection];
+ });
+}
+
+- (void)closeConnection
+{
+ [self assertOnWorkQueue];
+ SRDebugLog(@"Trying to disconnect");
+ _closeWhenFinishedWriting = YES;
+ [self _pumpWriting];
+}
+
+- (void)_handleFrameWithData:(NSData *)frameData opCode:(SROpCode)opcode
+{
+ // Check that the current data is valid UTF8
+
+ BOOL isControlFrame = (opcode == SROpCodePing || opcode == SROpCodePong || opcode == SROpCodeConnectionClose);
+ if (isControlFrame) {
+ //frameData will be copied before passing to handlers
+ //otherwise there can be misbehaviours when value at the pointer is changed
+ frameData = [frameData copy];
+
+ dispatch_async(_workQueue, ^{
+ [self _readFrameContinue];
+ });
+ } else {
+ [self _readFrameNew];
+ }
+
+ switch (opcode) {
+ case SROpCodeTextFrame: {
+ NSString *string = [[NSString alloc] initWithData:frameData encoding:NSUTF8StringEncoding];
+ if (!string && frameData) {
+ [self closeWithCode:SRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8."];
+ dispatch_async(_workQueue, ^{
+ [self closeConnection];
+ });
+ return;
+ }
+ SRDebugLog(@"Received text message.");
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ // Don't convert into string - iff `delegate` tells us not to. Otherwise - create UTF8 string and handle that.
+ if (availableMethods.shouldConvertTextFrameToString && ![delegate webSocketShouldConvertTextFrameToString:self]) {
+ if (availableMethods.didReceiveMessage) {
+ [delegate webSocket:self didReceiveMessage:frameData];
+ }
+ if (availableMethods.didReceiveMessageWithData) {
+ [delegate webSocket:self didReceiveMessageWithData:frameData];
+ }
+ } else {
+ if (availableMethods.didReceiveMessage) {
+ [delegate webSocket:self didReceiveMessage:string];
+ }
+ if (availableMethods.didReceiveMessageWithString) {
+ [delegate webSocket:self didReceiveMessageWithString:string];
+ }
+ }
+ }];
+ break;
+ }
+ case SROpCodeBinaryFrame: {
+ SRDebugLog(@"Received data message.");
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didReceiveMessage) {
+ [delegate webSocket:self didReceiveMessage:frameData];
+ }
+ if (availableMethods.didReceiveMessageWithData) {
+ [delegate webSocket:self didReceiveMessageWithData:frameData];
+ }
+ }];
+ }
+ break;
+ case SROpCodeConnectionClose:
+ [self handleCloseWithData:frameData];
+ break;
+ case SROpCodePing:
+ [self _handlePingWithData:frameData];
+ break;
+ case SROpCodePong:
+ [self handlePong:frameData];
+ break;
+ default:
+ [self _closeWithProtocolError:[NSString stringWithFormat:@"Unknown opcode %ld", (long)opcode]];
+ // TODO: Handle invalid opcode
+ break;
+ }
+}
+
+- (void)_handleFrameHeader:(frame_header)frame_header curData:(NSData *)curData
+{
+ assert(frame_header.opcode != 0);
+
+ if (self.readyState == SR_CLOSED) {
+ return;
+ }
+
+
+ BOOL isControlFrame = (frame_header.opcode == SROpCodePing || frame_header.opcode == SROpCodePong || frame_header.opcode == SROpCodeConnectionClose);
+
+ if (isControlFrame && !frame_header.fin) {
+ [self _closeWithProtocolError:@"Fragmented control frames not allowed"];
+ return;
+ }
+
+ if (isControlFrame && frame_header.payload_length >= 126) {
+ [self _closeWithProtocolError:@"Control frames cannot have payloads larger than 126 bytes"];
+ return;
+ }
+
+ if (!isControlFrame) {
+ _currentFrameOpcode = frame_header.opcode;
+ _currentFrameCount += 1;
+ }
+
+ if (frame_header.payload_length == 0) {
+ if (isControlFrame) {
+ [self _handleFrameWithData:curData opCode:frame_header.opcode];
+ } else {
+ if (frame_header.fin) {
+ [self _handleFrameWithData:_currentFrameData opCode:frame_header.opcode];
+ } else {
+ // TODO add assert that opcode is not a control;
+ [self _readFrameContinue];
+ }
+ }
+ } else {
+ assert(frame_header.payload_length <= SIZE_T_MAX);
+ [self _addConsumerWithDataLength:(size_t)frame_header.payload_length callback:^(SRWebSocket *sself, NSData *newData) {
+ if (isControlFrame) {
+ [sself _handleFrameWithData:newData opCode:frame_header.opcode];
+ } else {
+ if (frame_header.fin) {
+ [sself _handleFrameWithData:sself->_currentFrameData opCode:frame_header.opcode];
+ } else {
+ // TODO add assert that opcode is not a control;
+ [sself _readFrameContinue];
+ }
+ }
+ } readToCurrentFrame:!isControlFrame unmaskBytes:frame_header.masked];
+ }
+}
+
+/* From RFC:
+
+ 0 1 2 3
+ 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+ +-+-+-+-+-------+-+-------------+-------------------------------+
+ |F|R|R|R| opcode|M| Payload len | Extended payload length |
+ |I|S|S|S| (4) |A| (7) | (16/64) |
+ |N|V|V|V| |S| | (if payload len==126/127) |
+ | |1|2|3| |K| | |
+ +-+-+-+-+-------+-+-------------+ - - - - - - - - - - - - - - - +
+ | Extended payload length continued, if payload len == 127 |
+ + - - - - - - - - - - - - - - - +-------------------------------+
+ | |Masking-key, if MASK set to 1 |
+ +-------------------------------+-------------------------------+
+ | Masking-key (continued) | Payload Data |
+ +-------------------------------- - - - - - - - - - - - - - - - +
+ : Payload Data continued ... :
+ + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
+ | Payload Data continued ... |
+ +---------------------------------------------------------------+
+ */
+
+static const uint8_t SRFinMask = 0x80;
+static const uint8_t SROpCodeMask = 0x0F;
+static const uint8_t SRRsvMask = 0x70;
+static const uint8_t SRMaskMask = 0x80;
+static const uint8_t SRPayloadLenMask = 0x7F;
+
+
+- (void)_readFrameContinue
+{
+ assert((_currentFrameCount == 0 && _currentFrameOpcode == 0) || (_currentFrameCount > 0 && _currentFrameOpcode > 0));
+
+ [self _addConsumerWithDataLength:2 callback:^(SRWebSocket *sself, NSData *data) {
+ __block frame_header header = {0};
+
+ const uint8_t *headerBuffer = data.bytes;
+ assert(data.length >= 2);
+
+ if (headerBuffer[0] & SRRsvMask) {
+ [sself _closeWithProtocolError:@"Server used RSV bits"];
+ return;
+ }
+
+ uint8_t receivedOpcode = (SROpCodeMask & headerBuffer[0]);
+
+ BOOL isControlFrame = (receivedOpcode == SROpCodePing || receivedOpcode == SROpCodePong || receivedOpcode == SROpCodeConnectionClose);
+
+ if (!isControlFrame && receivedOpcode != 0 && sself->_currentFrameCount > 0) {
+ [sself _closeWithProtocolError:@"all data frames after the initial data frame must have opcode 0"];
+ return;
+ }
+
+ if (receivedOpcode == 0 && sself->_currentFrameCount == 0) {
+ [sself _closeWithProtocolError:@"cannot continue a message"];
+ return;
+ }
+
+ header.opcode = receivedOpcode == 0 ? sself->_currentFrameOpcode : receivedOpcode;
+
+ header.fin = !!(SRFinMask & headerBuffer[0]);
+
+
+ header.masked = !!(SRMaskMask & headerBuffer[1]);
+ header.payload_length = SRPayloadLenMask & headerBuffer[1];
+
+ headerBuffer = NULL;
+
+ if (header.masked) {
+ [sself _closeWithProtocolError:@"Client must receive unmasked data"];
+ return;
+ }
+
+ size_t extra_bytes_needed = header.masked ? sizeof(sself->_currentReadMaskKey) : 0;
+
+ if (header.payload_length == 126) {
+ extra_bytes_needed += sizeof(uint16_t);
+ } else if (header.payload_length == 127) {
+ extra_bytes_needed += sizeof(uint64_t);
+ }
+
+ if (extra_bytes_needed == 0) {
+ [sself _handleFrameHeader:header curData:sself->_currentFrameData];
+ } else {
+ [sself _addConsumerWithDataLength:extra_bytes_needed callback:^(SRWebSocket *eself, NSData *edata) {
+ size_t mapped_size = edata.length;
+#pragma unused (mapped_size)
+ const void *mapped_buffer = edata.bytes;
+ size_t offset = 0;
+
+ if (header.payload_length == 126) {
+ assert(mapped_size >= sizeof(uint16_t));
+ uint16_t payloadLength = 0;
+ memcpy(&payloadLength, mapped_buffer, sizeof(uint16_t));
+ payloadLength = CFSwapInt16BigToHost(payloadLength);
+
+ header.payload_length = payloadLength;
+ offset += sizeof(uint16_t);
+ } else if (header.payload_length == 127) {
+ assert(mapped_size >= sizeof(uint64_t));
+ uint64_t payloadLength = 0;
+ memcpy(&payloadLength, mapped_buffer, sizeof(uint64_t));
+ payloadLength = CFSwapInt64BigToHost(payloadLength);
+
+ header.payload_length = payloadLength;
+ offset += sizeof(uint64_t);
+ } else {
+ assert(header.payload_length < 126 && header.payload_length >= 0);
+ }
+
+ if (header.masked) {
+ assert(mapped_size >= sizeof(eself->_currentReadMaskOffset) + offset);
+ memcpy(eself->_currentReadMaskKey, ((uint8_t *)mapped_buffer) + offset, sizeof(eself->_currentReadMaskKey));
+ }
+
+ [eself _handleFrameHeader:header curData:eself->_currentFrameData];
+ } readToCurrentFrame:NO unmaskBytes:NO];
+ }
+ } readToCurrentFrame:NO unmaskBytes:NO];
+}
+
+- (void)_readFrameNew
+{
+ dispatch_async(_workQueue, ^{
+ // Don't reset the length, since Apple doesn't guarantee that this will free the memory (and in tests on
+ // some platforms, it doesn't seem to, effectively causing a leak the size of the biggest frame so far).
+ self->_currentFrameData = [[NSMutableData alloc] init];
+
+ self->_currentFrameOpcode = 0;
+ self->_currentFrameCount = 0;
+ self->_readOpCount = 0;
+ self->_currentStringScanPosition = 0;
+
+ [self _readFrameContinue];
+ });
+}
+
+- (void)_pumpWriting
+{
+ [self assertOnWorkQueue];
+
+ NSUInteger dataLength = dispatch_data_get_size(_outputBuffer);
+ if (dataLength - _outputBufferOffset > 0 && _outputStream.hasSpaceAvailable) {
+ __block NSInteger bytesWritten = 0;
+ __block BOOL streamFailed = NO;
+
+ dispatch_data_t dataToSend = dispatch_data_create_subrange(_outputBuffer, _outputBufferOffset, dataLength - _outputBufferOffset);
+ dispatch_data_apply(dataToSend, ^bool(dispatch_data_t region, size_t offset, const void *buffer, size_t size) {
+ NSInteger sentLength = [_outputStream write:buffer maxLength:size];
+ if (sentLength == -1) {
+ streamFailed = YES;
+ return false;
+ }
+ bytesWritten += sentLength;
+ return (sentLength >= (NSInteger)size); // If we can't write all the data into the stream - bail-out early.
+ });
+ if (streamFailed) {
+ NSInteger code = 2145;
+ NSString *description = @"Error writing to stream.";
+ NSError *streamError = _outputStream.streamError;
+ NSError *error = streamError ? SRErrorWithCodeDescriptionUnderlyingError(code, description, streamError) : SRErrorWithCodeDescription(code, description);
+ [self _failWithError:error];
+ return;
+ }
+
+ _outputBufferOffset += bytesWritten;
+
+ if (_outputBufferOffset > SRDefaultBufferSize() && _outputBufferOffset > dataLength / 2) {
+ _outputBuffer = dispatch_data_create_subrange(_outputBuffer, _outputBufferOffset, dataLength - _outputBufferOffset);
+ _outputBufferOffset = 0;
+ }
+ }
+
+ if (_closeWhenFinishedWriting &&
+ (dispatch_data_get_size(_outputBuffer) - _outputBufferOffset) == 0 &&
+ (_inputStream.streamStatus != NSStreamStatusNotOpen &&
+ _inputStream.streamStatus != NSStreamStatusClosed) &&
+ !_sentClose) {
+ _sentClose = YES;
+
+ @synchronized(self) {
+ [_outputStream close];
+ [_inputStream close];
+
+
+ for (NSArray *runLoop in [_scheduledRunloops copy]) {
+ [self unscheduleFromRunLoop:[runLoop objectAtIndex:0] forMode:[runLoop objectAtIndex:1]];
+ }
+ }
+
+ if (!_failed) {
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didCloseWithCode) {
+ [delegate webSocket:self didCloseWithCode:self->_closeCode reason:self->_closeReason wasClean:YES];
+ }
+ }];
+ }
+
+ [self _scheduleCleanup];
+ }
+}
+
+- (void)_addConsumerWithScanner:(stream_scanner)consumer callback:(data_callback)callback
+{
+ [self assertOnWorkQueue];
+ [self _addConsumerWithScanner:consumer callback:callback dataLength:0];
+}
+
+- (void)_addConsumerWithDataLength:(size_t)dataLength callback:(data_callback)callback readToCurrentFrame:(BOOL)readToCurrentFrame unmaskBytes:(BOOL)unmaskBytes
+{
+ [self assertOnWorkQueue];
+ assert(dataLength);
+
+ [_consumers addObject:[_consumerPool consumerWithScanner:nil handler:callback bytesNeeded:dataLength readToCurrentFrame:readToCurrentFrame unmaskBytes:unmaskBytes]];
+ [self _pumpScanner];
+}
+
+- (void)_addConsumerWithScanner:(stream_scanner)consumer callback:(data_callback)callback dataLength:(size_t)dataLength
+{
+ [self assertOnWorkQueue];
+ [_consumers addObject:[_consumerPool consumerWithScanner:consumer handler:callback bytesNeeded:dataLength readToCurrentFrame:NO unmaskBytes:NO]];
+ [self _pumpScanner];
+}
+
+
+- (void)_scheduleCleanup
+{
+ @synchronized(self) {
+ if (_cleanupScheduled) {
+ return;
+ }
+
+ _cleanupScheduled = YES;
+
+ // Cleanup NSStream delegate's in the same RunLoop used by the streams themselves:
+ // This way we'll prevent race conditions between handleEvent and SRWebsocket's dealloc
+ NSTimer *timer = [NSTimer timerWithTimeInterval:(0.0f) target:self selector:@selector(_cleanupSelfReference:) userInfo:nil repeats:NO];
+ [[NSRunLoop SR_networkRunLoop] addTimer:timer forMode:NSDefaultRunLoopMode];
+ }
+}
+
+- (void)_cleanupSelfReference:(NSTimer *)timer
+{
+ @synchronized(self) {
+ // Nuke NSStream delegate's
+ _inputStream.delegate = nil;
+ _outputStream.delegate = nil;
+
+ // Remove the streams, right now, from the networkRunLoop
+ [_inputStream close];
+ [_outputStream close];
+ }
+
+ // Cleanup selfRetain in the same GCD queue as usual
+ dispatch_async(_workQueue, ^{
+ self->_selfRetain = nil;
+ });
+}
+
+
+static const char CRLFCRLFBytes[] = {'\r', '\n', '\r', '\n'};
+
+- (void)_readUntilHeaderCompleteWithCallback:(data_callback)dataHandler
+{
+ [self _readUntilBytes:CRLFCRLFBytes length:sizeof(CRLFCRLFBytes) callback:dataHandler];
+}
+
+- (void)_readUntilBytes:(const void *)bytes length:(size_t)length callback:(data_callback)dataHandler
+{
+ // TODO optimize so this can continue from where we last searched
+ stream_scanner consumer = ^size_t(NSData *data) {
+ __block size_t found_size = 0;
+ __block size_t match_count = 0;
+
+ size_t size = data.length;
+ const unsigned char *buffer = data.bytes;
+ for (size_t i = 0; i < size; i++ ) {
+ if (((const unsigned char *)buffer)[i] == ((const unsigned char *)bytes)[match_count]) {
+ match_count += 1;
+ if (match_count == length) {
+ found_size = i + 1;
+ break;
+ }
+ } else {
+ match_count = 0;
+ }
+ }
+ return found_size;
+ };
+ [self _addConsumerWithScanner:consumer callback:dataHandler];
+}
+
+
+// Returns true if did work
+- (BOOL)_innerPumpScanner {
+
+ BOOL didWork = NO;
+
+ if (self.readyState >= SR_CLOSED) {
+ return didWork;
+ }
+
+ size_t readBufferSize = dispatch_data_get_size(_readBuffer);
+
+ if (!_consumers.count) {
+ return didWork;
+ }
+
+ size_t curSize = readBufferSize - _readBufferOffset;
+ if (!curSize) {
+ return didWork;
+ }
+
+ SRIOConsumer *consumer = [_consumers objectAtIndex:0];
+
+ size_t bytesNeeded = consumer.bytesNeeded;
+
+ size_t foundSize = 0;
+ if (consumer.consumer) {
+ NSData *subdata = (NSData *)dispatch_data_create_subrange(_readBuffer, _readBufferOffset, readBufferSize - _readBufferOffset);
+ foundSize = consumer.consumer(subdata);
+ } else {
+ assert(consumer.bytesNeeded);
+ if (curSize >= bytesNeeded) {
+ foundSize = bytesNeeded;
+ } else if (consumer.readToCurrentFrame) {
+ foundSize = curSize;
+ }
+ }
+
+ if (consumer.readToCurrentFrame || foundSize) {
+ dispatch_data_t slice = dispatch_data_create_subrange(_readBuffer, _readBufferOffset, foundSize);
+
+ _readBufferOffset += foundSize;
+
+ if (_readBufferOffset > SRDefaultBufferSize() && _readBufferOffset > readBufferSize / 2) {
+ _readBuffer = dispatch_data_create_subrange(_readBuffer, _readBufferOffset, readBufferSize - _readBufferOffset);
+ _readBufferOffset = 0;
+ }
+
+ if (consumer.unmaskBytes) {
+ __block NSMutableData *mutableSlice = [slice mutableCopy];
+
+ NSUInteger len = mutableSlice.length;
+ uint8_t *bytes = mutableSlice.mutableBytes;
+
+ for (NSUInteger i = 0; i < len; i++) {
+ bytes[i] = bytes[i] ^ _currentReadMaskKey[_currentReadMaskOffset % sizeof(_currentReadMaskKey)];
+ _currentReadMaskOffset += 1;
+ }
+
+ slice = dispatch_data_create(bytes, len, nil, ^{
+ mutableSlice = nil;
+ });
+ }
+
+ if (consumer.readToCurrentFrame) {
+ dispatch_data_apply(slice, ^bool(dispatch_data_t region, size_t offset, const void *buffer, size_t size) {
+ [_currentFrameData appendBytes:buffer length:size];
+ return true;
+ });
+
+ _readOpCount += 1;
+
+ if (_currentFrameOpcode == SROpCodeTextFrame) {
+ // Validate UTF8 stuff.
+ size_t currentDataSize = _currentFrameData.length;
+ if (_currentFrameOpcode == SROpCodeTextFrame && currentDataSize > 0) {
+ // TODO: Optimize the crap out of this. Don't really have to copy all the data each time
+
+ size_t scanSize = currentDataSize - _currentStringScanPosition;
+
+ NSData *scan_data = [_currentFrameData subdataWithRange:NSMakeRange(_currentStringScanPosition, scanSize)];
+ int32_t valid_utf8_size = validate_dispatch_data_partial_string(scan_data);
+
+ if (valid_utf8_size == -1) {
+ [self closeWithCode:SRStatusCodeInvalidUTF8 reason:@"Text frames must be valid UTF-8"];
+ dispatch_async(_workQueue, ^{
+ [self closeConnection];
+ });
+ return didWork;
+ } else {
+ _currentStringScanPosition += valid_utf8_size;
+ }
+ }
+
+ }
+
+ consumer.bytesNeeded -= foundSize;
+
+ if (consumer.bytesNeeded == 0) {
+ [_consumers removeObjectAtIndex:0];
+ consumer.handler(self, nil);
+ [_consumerPool returnConsumer:consumer];
+ didWork = YES;
+ }
+ } else if (foundSize) {
+ [_consumers removeObjectAtIndex:0];
+ consumer.handler(self, (NSData *)slice);
+ [_consumerPool returnConsumer:consumer];
+ didWork = YES;
+ }
+ }
+ return didWork;
+}
+
+-(void)_pumpScanner
+{
+ [self assertOnWorkQueue];
+
+ if (!_isPumping) {
+ _isPumping = YES;
+ } else {
+ return;
+ }
+
+ while ([self _innerPumpScanner]) {
+
+ }
+
+ _isPumping = NO;
+}
+
+//#define NOMASK
+
+static const size_t SRFrameHeaderOverhead = 32;
+
+- (void)_sendFrameWithOpcode:(SROpCode)opCode data:(NSData *)data
+{
+ [self assertOnWorkQueue];
+
+ if (!data) {
+ return;
+ }
+
+ size_t payloadLength = data.length;
+
+ NSMutableData *frameData = [[NSMutableData alloc] initWithLength:payloadLength + SRFrameHeaderOverhead];
+ if (!frameData) {
+ [self closeWithCode:SRStatusCodeMessageTooBig reason:@"Message too big"];
+ return;
+ }
+ uint8_t *frameBuffer = (uint8_t *)frameData.mutableBytes;
+
+ // set fin
+ frameBuffer[0] = SRFinMask | opCode;
+
+ // set the mask and header
+ frameBuffer[1] |= SRMaskMask;
+
+ size_t frameBufferSize = 2;
+
+ if (payloadLength < 126) {
+ frameBuffer[1] |= payloadLength;
+ } else {
+ uint64_t declaredPayloadLength = 0;
+ size_t declaredPayloadLengthSize = 0;
+
+ if (payloadLength <= UINT16_MAX) {
+ frameBuffer[1] |= 126;
+
+ declaredPayloadLength = CFSwapInt16BigToHost((uint16_t)payloadLength);
+ declaredPayloadLengthSize = sizeof(uint16_t);
+ } else {
+ frameBuffer[1] |= 127;
+
+ declaredPayloadLength = CFSwapInt64BigToHost((uint64_t)payloadLength);
+ declaredPayloadLengthSize = sizeof(uint64_t);
+ }
+
+ memcpy((frameBuffer + frameBufferSize), &declaredPayloadLength, declaredPayloadLengthSize);
+ frameBufferSize += declaredPayloadLengthSize;
+ }
+
+ const uint8_t *unmaskedPayloadBuffer = (uint8_t *)data.bytes;
+ uint8_t *maskKey = frameBuffer + frameBufferSize;
+
+ size_t randomBytesSize = sizeof(uint32_t);
+ NSData *randomData = SRRandomData(randomBytesSize);
+ [randomData getBytes:maskKey range:NSMakeRange(0, randomBytesSize)];
+ frameBufferSize += randomBytesSize;
+
+ // Copy and unmask the buffer
+ uint8_t *frameBufferPayloadPointer = frameBuffer + frameBufferSize;
+
+ memcpy(frameBufferPayloadPointer, unmaskedPayloadBuffer, payloadLength);
+ SRMaskBytesSIMD(frameBufferPayloadPointer, payloadLength, maskKey);
+ frameBufferSize += payloadLength;
+
+ assert(frameBufferSize <= frameData.length);
+ frameData.length = frameBufferSize;
+
+ [self _writeData:frameData];
+}
+
+- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode
+{
+ __weak typeof(self) wself = self;
+
+ if (_requestRequiresSSL && !_streamSecurityValidated &&
+ (eventCode == NSStreamEventHasBytesAvailable || eventCode == NSStreamEventHasSpaceAvailable)) {
+ SecTrustRef trust = (__bridge SecTrustRef)[aStream propertyForKey:(__bridge id)kCFStreamPropertySSLPeerTrust];
+ if (trust) {
+ NSString *const host = _urlRequest.URL.host;
+ if (!host || host.length == 0) {
+ dispatch_async(_workQueue, ^{
+ NSError *error = SRErrorWithDomainCodeDescription(NSURLErrorDomain,
+ NSURLErrorBadURL,
+ @"Unable to validate certificate for empty host.");
+ [wself _failWithError:error];
+ });
+ return;
+ }
+ _streamSecurityValidated = [_securityPolicy evaluateServerTrust:trust forDomain:host];
+ }
+ if (!_streamSecurityValidated) {
+ dispatch_async(_workQueue, ^{
+ NSError *error = SRErrorWithDomainCodeDescription(NSURLErrorDomain,
+ NSURLErrorClientCertificateRejected,
+ @"Invalid server certificate.");
+ [wself _failWithError:error];
+ });
+ return;
+ }
+ dispatch_async(_workQueue, ^{
+ [self didConnect];
+ });
+ }
+ dispatch_async(_workQueue, ^{
+ [wself safeHandleEvent:eventCode stream:aStream];
+ });
+}
+
+- (void)safeHandleEvent:(NSStreamEvent)eventCode stream:(NSStream *)aStream
+{
+ switch (eventCode) {
+ case NSStreamEventOpenCompleted: {
+ SRDebugLog(@"NSStreamEventOpenCompleted %@", aStream);
+ if (self.readyState >= SR_CLOSING) {
+ return;
+ }
+ assert(_readBuffer);
+
+ if (!_requestRequiresSSL && self.readyState == SR_CONNECTING && aStream == _inputStream) {
+ [self didConnect];
+ }
+
+ [self _pumpWriting];
+ [self _pumpScanner];
+
+ break;
+ }
+
+ case NSStreamEventErrorOccurred: {
+ SRDebugLog(@"NSStreamEventErrorOccurred %@ %@", aStream, [[aStream streamError] copy]);
+ /// TODO specify error better!
+ [self _failWithError:aStream.streamError];
+ _readBufferOffset = 0;
+ _readBuffer = dispatch_data_empty;
+ break;
+
+ }
+
+ case NSStreamEventEndEncountered: {
+ [self _pumpScanner];
+ SRDebugLog(@"NSStreamEventEndEncountered %@", aStream);
+ if (aStream.streamError) {
+ [self _failWithError:aStream.streamError];
+ } else {
+ dispatch_async(_workQueue, ^{
+ if (self.readyState != SR_CLOSED) {
+ self.readyState = SR_CLOSED;
+ [self _scheduleCleanup];
+ }
+
+ if (!self->_sentClose && !self->_failed) {
+ self->_sentClose = YES;
+ // If we get closed in this state it's probably not clean because we should be sending this when we send messages
+ [self.delegateController performDelegateBlock:^(id<SRWebSocketDelegate> _Nullable delegate, SRDelegateAvailableMethods availableMethods) {
+ if (availableMethods.didCloseWithCode) {
+ [delegate webSocket:self
+ didCloseWithCode:SRStatusCodeGoingAway
+ reason:@"Stream end encountered"
+ wasClean:NO];
+ }
+ }];
+ }
+ });
+ }
+
+ break;
+ }
+
+ case NSStreamEventHasBytesAvailable: {
+ SRDebugLog(@"NSStreamEventHasBytesAvailable %@", aStream);
+ uint8_t buffer[SRDefaultBufferSize()];
+
+ while (_inputStream.hasBytesAvailable) {
+ NSInteger bytesRead = [_inputStream read:buffer maxLength:SRDefaultBufferSize()];
+ if (bytesRead > 0) {
+ dispatch_data_t data = dispatch_data_create(buffer, bytesRead, nil, DISPATCH_DATA_DESTRUCTOR_DEFAULT);
+ if (!data) {
+ NSError *error = SRErrorWithCodeDescription(SRStatusCodeMessageTooBig,
+ @"Unable to allocate memory to read from socket.");
+ [self _failWithError:error];
+ return;
+ }
+ _readBuffer = dispatch_data_create_concat(_readBuffer, data);
+ } else if (bytesRead == -1) {
+ [self _failWithError:_inputStream.streamError];
+ }
+ }
+ [self _pumpScanner];
+ break;
+ }
+
+ case NSStreamEventHasSpaceAvailable: {
+ SRDebugLog(@"NSStreamEventHasSpaceAvailable %@", aStream);
+ [self _pumpWriting];
+ break;
+ }
+
+ case NSStreamEventNone:
+ SRDebugLog(@"(default) %@", aStream);
+ break;
+ }
+}
+
+///--------------------------------------
+#pragma mark - Delegate
+///--------------------------------------
+
+- (id<SRWebSocketDelegate> _Nullable)delegate
+{
+ return self.delegateController.delegate;
+}
+
+- (void)setDelegate:(id<SRWebSocketDelegate> _Nullable)delegate
+{
+ self.delegateController.delegate = delegate;
+}
+
+- (void)setDelegateDispatchQueue:(dispatch_queue_t _Nullable)queue
+{
+ self.delegateController.dispatchQueue = queue;
+}
+
+- (dispatch_queue_t _Nullable)delegateDispatchQueue
+{
+ return self.delegateController.dispatchQueue;
+}
+
+- (void)setDelegateOperationQueue:(NSOperationQueue *_Nullable)queue
+{
+ self.delegateController.operationQueue = queue;
+}
+
+- (NSOperationQueue *_Nullable)delegateOperationQueue
+{
+ return self.delegateController.operationQueue;
+}
+
+@end
+
+#ifdef HAS_ICU
+
+static inline int32_t validate_dispatch_data_partial_string(NSData *data) {
+ if ([data length] > INT32_MAX) {
+ // INT32_MAX is the limit so long as this Framework is using 32 bit ints everywhere.
+ return -1;
+ }
+
+ int32_t size = (int32_t)[data length];
+
+ const void * contents = [data bytes];
+ const uint8_t *str = (const uint8_t *)contents;
+
+ UChar32 codepoint = 1;
+ int32_t offset = 0;
+ int32_t lastOffset = 0;
+ while(offset < size && codepoint > 0) {
+ lastOffset = offset;
+ U8_NEXT(str, offset, size, codepoint);
+ }
+
+ if (codepoint == -1) {
+ // Check to see if the last byte is valid or whether it was just continuing
+ if (!U8_IS_LEAD(str[lastOffset]) || U8_COUNT_TRAIL_BYTES(str[lastOffset]) + lastOffset < (int32_t)size) {
+
+ size = -1;
+ } else {
+ uint8_t leadByte = str[lastOffset];
+ U8_MASK_LEAD_BYTE(leadByte, U8_COUNT_TRAIL_BYTES(leadByte));
+
+ for (int i = lastOffset + 1; i < offset; i++) {
+ if (U8_IS_SINGLE(str[i]) || U8_IS_LEAD(str[i]) || !U8_IS_TRAIL(str[i])) {
+ size = -1;
+ }
+ }
+
+ if (size != -1) {
+ size = lastOffset;
+ }
+ }
+ }
+
+ if (size != -1 && ![[NSString alloc] initWithBytesNoCopy:(char *)[data bytes] length:size encoding:NSUTF8StringEncoding freeWhenDone:NO]) {
+ size = -1;
+ }
+
+ return size;
+}
+
+#else
+
+// This is a hack, and probably not optimal
+static inline int32_t validate_dispatch_data_partial_string(NSData *data) {
+ static const int maxCodepointSize = 3;
+
+ for (int i = 0; i < maxCodepointSize; i++) {
+ NSString *str = [[NSString alloc] initWithBytesNoCopy:(char *)data.bytes length:data.length - i encoding:NSUTF8StringEncoding freeWhenDone:NO];
+ if (str) {
+ return (int32_t)data.length - i;
+ }
+ }
+
+ return -1;
+}
+
+#endif
--- /dev/null
+//
+// Copyright 2012 Square Inc.
+// Portions Copyright (c) 2016-present, Facebook, Inc.
+//
+// All rights reserved.
+//
+// This source code is licensed under the BSD-style license found in the
+// LICENSE file in the root directory of this source tree. An additional grant
+// of patent rights can be found in the PATENTS file in the same directory.
+//
+
+#import <SocketRocket/NSRunLoop+SRWebSocket.h>
+#import <SocketRocket/NSURLRequest+SRWebSocket.h>
+#import <SocketRocket/SRSecurityPolicy.h>
+#import <SocketRocket/SRWebSocket.h>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>${PODS_DEVELOPMENT_LANGUAGE}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0.0</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+# Acknowledgements
+This application makes use of the following third party libraries:
+
+## SVProgressHUD
+
+MIT License
+
+Copyright (c) 2011-2023 Sam Vermette, Tobias Totzek and contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+
+## SnapKit
+
+Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+
+
+## SocketRocket
+
+BSD License
+
+For SocketRocket software
+
+Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+Generated by CocoaPods - https://cocoapods.org
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>PreferenceSpecifiers</key>
+ <array>
+ <dict>
+ <key>FooterText</key>
+ <string>This application makes use of the following third party libraries:</string>
+ <key>Title</key>
+ <string>Acknowledgements</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>MIT License
+
+Copyright (c) 2011-2023 Sam Vermette, Tobias Totzek and contributors.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+</string>
+ <key>License</key>
+ <string>MIT</string>
+ <key>Title</key>
+ <string>SVProgressHUD</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>Copyright (c) 2011-Present SnapKit Team - https://github.com/SnapKit
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+</string>
+ <key>License</key>
+ <string>MIT</string>
+ <key>Title</key>
+ <string>SnapKit</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>BSD License
+
+For SocketRocket software
+
+Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+ * Neither the name Facebook nor the names of its contributors may be used to
+ endorse or promote products derived from this software without specific
+ prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</string>
+ <key>License</key>
+ <string>BSD</string>
+ <key>Title</key>
+ <string>SocketRocket</string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ <dict>
+ <key>FooterText</key>
+ <string>Generated by CocoaPods - https://cocoapods.org</string>
+ <key>Title</key>
+ <string></string>
+ <key>Type</key>
+ <string>PSGroupSpecifier</string>
+ </dict>
+ </array>
+ <key>StringsTable</key>
+ <string>Acknowledgements</string>
+ <key>Title</key>
+ <string>Acknowledgements</string>
+</dict>
+</plist>
--- /dev/null
+#import <Foundation/Foundation.h>
+@interface PodsDummy_Pods_JoyGemAIDemo : NSObject
+@end
+@implementation PodsDummy_Pods_JoyGemAIDemo
+@end
--- /dev/null
+${PODS_ROOT}/Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-frameworks.sh
+${BUILT_PRODUCTS_DIR}/SVProgressHUD/SVProgressHUD.framework
+${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework
+${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework
\ No newline at end of file
--- /dev/null
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SVProgressHUD.framework
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework
\ No newline at end of file
--- /dev/null
+${PODS_ROOT}/Target Support Files/Pods-JoyGemAIDemo/Pods-JoyGemAIDemo-frameworks.sh
+${BUILT_PRODUCTS_DIR}/SVProgressHUD/SVProgressHUD.framework
+${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework
+${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework
\ No newline at end of file
--- /dev/null
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SVProgressHUD.framework
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SnapKit.framework
+${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/SocketRocket.framework
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+set -e
+set -u
+set -o pipefail
+
+function on_error {
+ echo "$(realpath -mq "${0}"):$1: error: Unexpected failure"
+}
+trap 'on_error $LINENO' ERR
+
+if [ -z ${FRAMEWORKS_FOLDER_PATH+x} ]; then
+ # If FRAMEWORKS_FOLDER_PATH is not set, then there's nowhere for us to copy
+ # frameworks to, so exit 0 (signalling the script phase was successful).
+ exit 0
+fi
+
+echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
+mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
+
+COCOAPODS_PARALLEL_CODE_SIGN="${COCOAPODS_PARALLEL_CODE_SIGN:-false}"
+SWIFT_STDLIB_PATH="${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
+BCSYMBOLMAP_DIR="BCSymbolMaps"
+
+
+# This protects against multiple targets copying the same framework dependency at the same time. The solution
+# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
+RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
+
+# Copies and strips a vendored framework
+install_framework()
+{
+ if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
+ local source="${BUILT_PRODUCTS_DIR}/$1"
+ elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then
+ local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")"
+ elif [ -r "$1" ]; then
+ local source="$1"
+ fi
+
+ local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
+
+ if [ -L "${source}" ]; then
+ echo "Symlinked..."
+ source="$(readlink -f "${source}")"
+ fi
+
+ if [ -d "${source}/${BCSYMBOLMAP_DIR}" ]; then
+ # Locate and install any .bcsymbolmaps if present, and remove them from the .framework before the framework is copied
+ find "${source}/${BCSYMBOLMAP_DIR}" -name "*.bcsymbolmap"|while read f; do
+ echo "Installing $f"
+ install_bcsymbolmap "$f" "$destination"
+ rm "$f"
+ done
+ rmdir "${source}/${BCSYMBOLMAP_DIR}"
+ fi
+
+ # Use filter instead of exclude so missing patterns don't throw errors.
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
+
+ local basename
+ basename="$(basename -s .framework "$1")"
+ binary="${destination}/${basename}.framework/${basename}"
+
+ if ! [ -r "$binary" ]; then
+ binary="${destination}/${basename}"
+ elif [ -L "${binary}" ]; then
+ echo "Destination binary is symlinked..."
+ dirname="$(dirname "${binary}")"
+ binary="${dirname}/$(readlink "${binary}")"
+ fi
+
+ # Strip invalid architectures so "fat" simulator / device frameworks work on device
+ if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then
+ strip_invalid_archs "$binary"
+ fi
+
+ # Resign the code if required by the build settings to avoid unstable apps
+ code_sign_if_enabled "${destination}/$(basename "$1")"
+
+ # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7.
+ if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then
+ local swift_runtime_libs
+ swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u)
+ for lib in $swift_runtime_libs; do
+ echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\""
+ rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}"
+ code_sign_if_enabled "${destination}/${lib}"
+ done
+ fi
+}
+# Copies and strips a vendored dSYM
+install_dsym() {
+ local source="$1"
+ warn_missing_arch=${2:-true}
+ if [ -r "$source" ]; then
+ # Copy the dSYM into the targets temp dir.
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
+
+ local basename
+ basename="$(basename -s .dSYM "$source")"
+ binary_name="$(ls "$source/Contents/Resources/DWARF")"
+ binary="${DERIVED_FILES_DIR}/${basename}.dSYM/Contents/Resources/DWARF/${binary_name}"
+
+ # Strip invalid architectures from the dSYM.
+ if [[ "$(file "$binary")" == *"Mach-O "*"dSYM companion"* ]]; then
+ strip_invalid_archs "$binary" "$warn_missing_arch"
+ fi
+ if [[ $STRIP_BINARY_RETVAL == 0 ]]; then
+ # Move the stripped file into its final destination.
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --links --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
+ else
+ # The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
+ mkdir -p "${DWARF_DSYM_FOLDER_PATH}"
+ touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.dSYM"
+ fi
+ fi
+}
+
+# Used as a return value for each invocation of `strip_invalid_archs` function.
+STRIP_BINARY_RETVAL=0
+
+# Strip invalid architectures
+strip_invalid_archs() {
+ binary="$1"
+ warn_missing_arch=${2:-true}
+ # Get architectures for current target binary
+ binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
+ # Intersect them with the architectures we are building for
+ intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
+ # If there are no archs supported by this binary then warn the user
+ if [[ -z "$intersected_archs" ]]; then
+ if [[ "$warn_missing_arch" == "true" ]]; then
+ echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
+ fi
+ STRIP_BINARY_RETVAL=1
+ return
+ fi
+ stripped=""
+ for arch in $binary_archs; do
+ if ! [[ "${ARCHS}" == *"$arch"* ]]; then
+ # Strip non-valid architectures in-place
+ lipo -remove "$arch" -output "$binary" "$binary"
+ stripped="$stripped $arch"
+ fi
+ done
+ if [[ "$stripped" ]]; then
+ echo "Stripped $binary of architectures:$stripped"
+ fi
+ STRIP_BINARY_RETVAL=0
+}
+
+# Copies the bcsymbolmap files of a vendored framework
+install_bcsymbolmap() {
+ local bcsymbolmap_path="$1"
+ local destination="${BUILT_PRODUCTS_DIR}"
+ echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}""
+ rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${bcsymbolmap_path}" "${destination}"
+}
+
+# Signs a framework with the provided identity
+code_sign_if_enabled() {
+ if [ -n "${EXPANDED_CODE_SIGN_IDENTITY:-}" -a "${CODE_SIGNING_REQUIRED:-}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
+ # Use the current code_sign_identity
+ echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}"
+ local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS:-} --preserve-metadata=identifier,entitlements '$1'"
+
+ if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
+ code_sign_cmd="$code_sign_cmd &"
+ fi
+ echo "$code_sign_cmd"
+ eval "$code_sign_cmd"
+ fi
+}
+
+if [[ "$CONFIGURATION" == "Debug" ]]; then
+ install_framework "${BUILT_PRODUCTS_DIR}/SVProgressHUD/SVProgressHUD.framework"
+ install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
+ install_framework "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework"
+fi
+if [[ "$CONFIGURATION" == "Release" ]]; then
+ install_framework "${BUILT_PRODUCTS_DIR}/SVProgressHUD/SVProgressHUD.framework"
+ install_framework "${BUILT_PRODUCTS_DIR}/SnapKit/SnapKit.framework"
+ install_framework "${BUILT_PRODUCTS_DIR}/SocketRocket/SocketRocket.framework"
+fi
+if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then
+ wait
+fi
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
+
+FOUNDATION_EXPORT double Pods_JoyGemAIDemoVersionNumber;
+FOUNDATION_EXPORT const unsigned char Pods_JoyGemAIDemoVersionString[];
+
--- /dev/null
+ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket"
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD/SVProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket/SocketRocket.framework/Headers"
+LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
+LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
+OTHER_LDFLAGS = $(inherited) -l"icucore" -l"swiftCoreGraphics" -framework "CFNetwork" -framework "QuartzCore" -framework "SVProgressHUD" -framework "Security" -framework "SnapKit" -framework "SocketRocket"
+OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD" "-F${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "-F${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket"
+OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
+PODS_ROOT = ${SRCROOT}/Pods
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+framework module Pods_JoyGemAIDemo {
+ umbrella header "Pods-JoyGemAIDemo-umbrella.h"
+
+ export *
+ module * { export * }
+}
--- /dev/null
+ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket"
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+HEADER_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD/SVProgressHUD.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SnapKit/SnapKit.framework/Headers" "${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket/SocketRocket.framework/Headers"
+LD_RUNPATH_SEARCH_PATHS = $(inherited) /usr/lib/swift '@executable_path/Frameworks' '@loader_path/Frameworks'
+LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
+OTHER_LDFLAGS = $(inherited) -l"icucore" -l"swiftCoreGraphics" -framework "CFNetwork" -framework "QuartzCore" -framework "SVProgressHUD" -framework "Security" -framework "SnapKit" -framework "SocketRocket"
+OTHER_MODULE_VERIFIER_FLAGS = $(inherited) "-F${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD" "-F${PODS_CONFIGURATION_BUILD_DIR}/SnapKit" "-F${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket"
+OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
+PODS_ROOT = ${SRCROOT}/Pods
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>${PODS_DEVELOPMENT_LANGUAGE}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>2.3.1</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+#import <Foundation/Foundation.h>
+@interface PodsDummy_SVProgressHUD : NSObject
+@end
+@implementation PodsDummy_SVProgressHUD
+@end
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
+#import "SVIndefiniteAnimatedView.h"
+#import "SVProgressAnimatedView.h"
+#import "SVProgressHUD.h"
+#import "SVRadialGradientLayer.h"
+
+FOUNDATION_EXPORT double SVProgressHUDVersionNumber;
+FOUNDATION_EXPORT const unsigned char SVProgressHUDVersionString[];
+
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+OTHER_LDFLAGS = $(inherited) -framework "QuartzCore"
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SVProgressHUD
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+framework module SVProgressHUD {
+ umbrella header "SVProgressHUD-umbrella.h"
+
+ export *
+ module * { export * }
+}
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SVProgressHUD
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+OTHER_LDFLAGS = $(inherited) -framework "QuartzCore"
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SVProgressHUD
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>${PODS_DEVELOPMENT_LANGUAGE}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>BNDL</string>
+ <key>CFBundleShortVersionString</key>
+ <string>5.7.1</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>${PODS_DEVELOPMENT_LANGUAGE}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>5.7.1</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+#import <Foundation/Foundation.h>
+@interface PodsDummy_SnapKit : NSObject
+@end
+@implementation PodsDummy_SnapKit
+@end
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
+
+FOUNDATION_EXPORT double SnapKitVersionNumber;
+FOUNDATION_EXPORT const unsigned char SnapKitVersionString[];
+
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
+OTHER_LDFLAGS = $(inherited) -l"swiftCoreGraphics"
+OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+framework module SnapKit {
+ umbrella header "SnapKit-umbrella.h"
+
+ export *
+ module * { export * }
+}
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SnapKit
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+LIBRARY_SEARCH_PATHS = $(inherited) "${TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" /usr/lib/swift $(SDKROOT)/usr/lib/swift
+OTHER_LDFLAGS = $(inherited) -l"swiftCoreGraphics"
+OTHER_SWIFT_FLAGS = $(inherited) -D COCOAPODS
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SnapKit
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>${PODS_DEVELOPMENT_LANGUAGE}</string>
+ <key>CFBundleExecutable</key>
+ <string>${EXECUTABLE_NAME}</string>
+ <key>CFBundleIdentifier</key>
+ <string>${PRODUCT_BUNDLE_IDENTIFIER}</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundleName</key>
+ <string>${PRODUCT_NAME}</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleShortVersionString</key>
+ <string>0.7.1</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>${CURRENT_PROJECT_VERSION}</string>
+ <key>NSPrincipalClass</key>
+ <string></string>
+</dict>
+</plist>
--- /dev/null
+#import <Foundation/Foundation.h>
+@interface PodsDummy_SocketRocket : NSObject
+@end
+@implementation PodsDummy_SocketRocket
+@end
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
--- /dev/null
+#ifdef __OBJC__
+#import <UIKit/UIKit.h>
+#else
+#ifndef FOUNDATION_EXPORT
+#if defined(__cplusplus)
+#define FOUNDATION_EXPORT extern "C"
+#else
+#define FOUNDATION_EXPORT extern
+#endif
+#endif
+#endif
+
+#import "NSRunLoop+SRWebSocket.h"
+#import "NSURLRequest+SRWebSocket.h"
+#import "SocketRocket.h"
+#import "SRSecurityPolicy.h"
+#import "SRWebSocket.h"
+
+FOUNDATION_EXPORT double SocketRocketVersionNumber;
+FOUNDATION_EXPORT const unsigned char SocketRocketVersionString[];
+
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+OTHER_LDFLAGS = $(inherited) -l"icucore" -framework "CFNetwork" -framework "Security"
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SocketRocket
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+framework module SocketRocket {
+ umbrella header "SocketRocket-umbrella.h"
+
+ export *
+ module * { export * }
+}
--- /dev/null
+CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = NO
+CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/SocketRocket
+GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
+OTHER_LDFLAGS = $(inherited) -l"icucore" -framework "CFNetwork" -framework "Security"
+PODS_BUILD_DIR = ${BUILD_DIR}
+PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
+PODS_DEVELOPMENT_LANGUAGE = ${DEVELOPMENT_LANGUAGE}
+PODS_ROOT = ${SRCROOT}
+PODS_TARGET_SRCROOT = ${PODS_ROOT}/SocketRocket
+PODS_XCFRAMEWORKS_BUILD_DIR = $(PODS_CONFIGURATION_BUILD_DIR)/XCFrameworkIntermediates
+PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}
+SKIP_INSTALL = YES
+USE_RECURSIVE_SCRIPT_INPUTS_IN_SCRIPT_PHASES = YES
--- /dev/null
+# source 'https://kkgithub.com/CocoaPods/Specs.git'
+source "https://gitee.com/mirrors/CocoaPods-Specs.git"
+platform :ios, '13.0'
+use_frameworks!
+
+target 'JoyGemAIDemo' do
+ pod 'SnapKit', '~> 5.7.0'
+ pod 'SVProgressHUD'
+ #pod 'SocketRocket'
+end