Skip to content

ShazamKit macOS xcode13.0 beta1

tj_devel709 edited this page Jul 23, 2021 · 4 revisions

#ShazamKit.framework https://github.com/xamarin/xamarin-macios/pull/12189

diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCatalog.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCatalog.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCatalog.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCatalog.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,37 @@
+//
+//  SHCatalog.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief An abstract base class for storing signatures
+///
+/// @discussion You should not create instances of this class directly, instead use subclasses to provide the
+/// functionality that you need
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHCatalog : NSObject
+
+/// @brief The minimum @c SHSignature duration that can be used to perform searches against this Catalog
+///
+/// @discussion A @c SHSignature that contains less than the minimum duration in seconds will be discarded without matching.
+/// @note A @c SHSignature under this duration does not have enough entropy to provide accurate matches.
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) NSTimeInterval minimumQuerySignatureDuration;
+
+/// @brief The maximum @c SHSignature duration that can be used to perform searches against this Catalog
+///
+/// @discussion A @c SHSignature over this duration will be rejected without matching. A well scoped @c SHSignature
+/// is more likely to provide accurate matches.
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) NSTimeInterval maximumQuerySignatureDuration;
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCustomCatalog.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCustomCatalog.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCustomCatalog.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHCustomCatalog.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,48 @@
+//
+//  SHCustomCatalog.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+#import <ShazamKit/SHSignature.h>
+#import <ShazamKit/SHMediaItem.h>
+#import <ShazamKit/SHCatalog.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief Configure a custom catalog of @c SHSignature objects to match against
+/// @discussion Use a custom catalog if you intend to search against reference signatures that you have provided yourself. All matches will be performed locally on the device against the signatures added to this Catalog.
+/// @c SHMediaItem can be built using custom data that will be returned when a match is made.
+/// Once this catalog has been built it can be written to disk and loaded again at a later date.
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHCustomCatalog : SHCatalog
+
+/// Add a reference @c SHSignature and its associated @c SHMediaItem for matching
+/// @param signature The reference to match against
+/// @param mediaItems The metadata associated with the @c SHSignature
+/// @discussion Once the @c SHCatalog had been added to a @c SHSession further calls to this method will be ignored
+- (BOOL)addReferenceSignature:(SHSignature *)signature representingMediaItems:(NSArray<SHMediaItem *> *)mediaItems error:(NSError **)error;
+
+/// Load a pre made Custom catalog from disk
+/// @param customCatalogURL The path to the assets
+/// @param error An error if the bundle could not be loaded
+- (BOOL)addCustomCatalogFromURL:(NSURL *)customCatalogURL error:(NSError **)error;
+
+/// Write this Catalog to disk
+/// @discussion A Catalog can safely be shared among devices
+/// @note If the `destinationURL` is a directory, a file named Signatures.shazamcatalog will be created
+/// @param destinationURL The location to write to
+/// @param error populated on error, otherwise nil
+/// @return YES on success, NO on failure with a populated error parameter
+- (BOOL)writeToURL:(NSURL *)destinationURL error:(NSError **)error;
+
++ (instancetype)new API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0)) NS_SWIFT_UNAVAILABLE("Use init in Swift");
+- (instancetype)init API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0));
+
+@end
+
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHDefines.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHDefines.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHDefines.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHDefines.h	2021-06-01 21:16:53.000000000 -0400
@@ -0,0 +1,19 @@
+//
+//  SHDefines.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#include <TargetConditionals.h>
+
+#ifndef SHDEFINES_H
+#define SHDEFINES_H
+
+#ifdef __cplusplus
+#define SH_EXPORT extern "C" __attribute__((visibility ("default")))
+#else
+#define SH_EXPORT extern __attribute__((visibility ("default")))
+#endif
+
+#endif /* SHDEFINES_H */
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHError.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHError.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHError.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHError.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,54 @@
+//
+//  SHError.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+
+SH_EXPORT NSErrorDomain const SHErrorDomain API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0));
+
+/// Error codes returned when generating and matching signatures
+API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+typedef NS_ERROR_ENUM(SHErrorDomain, SHErrorCode) {
+    
+    /// The @c AVAudioFormat is not supported
+    /// @discussion ShazamKit only accepts certain audio formats
+    /// @see -[SHSignatureGenerator appendBuffer:atTime:error] for valid formats
+    SHErrorCodeInvalidAudioFormat = 100,
+    
+    /// The audio provided was not contiguous
+    /// @discussion Shazam requires audio to be contiguous in order
+    /// to match.
+    SHErrorCodeAudioDiscontinuity = 101,
+    
+    /// Failed to create a signature from the provided audio
+    /// @discussion Validate the audio you are supplying, it may be silence.
+    SHErrorCodeSignatureInvalid = 200,
+    
+    /// The signature duration is outside the valid range
+    /// @discussion The signature is valid but is too long/short for
+    /// the service attempting to match it
+    SHErrorCodeSignatureDurationInvalid = 201,
+    
+    /// The request to match the signature failed
+    /// @discussion The attempt failed and was not matched, trying again may result in success
+    /// @note This code does not indicate a 'No Match'
+    SHErrorCodeMatchAttemptFailed = 202,
+    
+    /// Failed to load the Custom Catalog
+    /// @discussion Validate the structure of the Catalog file
+    SHErrorCodeCustomCatalogInvalid = 300,
+    
+    /// The Custom Catalog URL was invalid
+    /// @discussion The URL must be a filePath URL that contains a valid Catalog
+    SHErrorCodeCustomCatalogInvalidURL = 301,
+    
+    /// Failed to sync some content to the user's library
+    /// @discussion Failed to add some items to the user's library, trying again may result in success
+    /// Underlying error may contain more details about the failure
+    SHErrorCodeMediaLibrarySyncFailed = 400
+       
+};
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatch.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatch.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatch.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatch.h	2021-06-02 11:08:08.000000000 -0400
@@ -0,0 +1,36 @@
+//
+//  SHMatch.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+#import <ShazamKit/SHSignature.h>
+#import <ShazamKit/SHMatchedMediaItem.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief A @c SHMatch indicates that a Signature matched a reference Signature in the target @c SHCatalog
+/// @discussion A @c SHSignature can match many reference Signatures in a catalog and in turn a Signature can map to
+/// many @c SHMediaItem. Therefore a match encapsulates the query signature and all of the various @c SHMediaItem it matched
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHMatch : NSObject <NSSecureCoding>
+
+/// @brief The @c SHMatchedMediaItem belonging to the instance of @c SHSignature that we matched
+///
+/// @discussion One signature may match multiple @c SHMediaItem, especially in the case of audio that uses samples. The @c SHMatchedMediaItem
+/// are ordered by  the quality of the match. Use the first @c SHMediaItem if you intend to only show one result
+@property (NS_NONATOMIC_IOSONLY, strong, readonly) NSArray<SHMatchedMediaItem *> *mediaItems;
+
+/// The @c SHSignature used to search the @c SHCatalog
+/// @note This is Signature is the query Signature, not the reference signature contained in the @c SHCatalog
+@property (NS_NONATOMIC_IOSONLY, strong, readonly) SHSignature *querySignature;
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatchedMediaItem.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatchedMediaItem.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatchedMediaItem.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMatchedMediaItem.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,39 @@
+//
+//  SHMatchedMediaItem.h
+//  ShazamKit
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <ShazamKit/SHMediaItem.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// How far in seconds is this match from the start of the reference audio
+SH_EXPORT SHMediaItemProperty const SHMediaItemMatchOffset;
+
+/// How much the match differs in frequency from reference material
+SH_EXPORT SHMediaItemProperty const SHMediaItemFrequencySkew;
+
+/// @brief @c SHMatchedMediaItem represents metadata that has been matched against a @c SHCatalog
+/// @discussion Extra information is presented that can only be generated from a match. The properties provided here
+/// that are not available on @c SHMediaItem are ephemeral and can differ each time there is a match of the @c SHSignature that this
+/// object represents
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHMatchedMediaItem : SHMediaItem <NSSecureCoding>
+
+/// The frequency difference between the reference and sample audio
+/// @discussion A value of 0.0 indicates the matched audio at the original frequency,
+/// a value of 0.1 indicates 100hz is now 110hz
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) float frequencySkew;
+
+/// @brief The difference between the start of the reference audio and the start of the sample audio
+/// @note This value can be negative if the source audio starts before the reference audio
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) NSTimeInterval matchOffset;
+
+/// @brief The auto updating playback position in the reference signature
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) NSTimeInterval predictedCurrentMatchOffset;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaItem.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaItem.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaItem.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaItem.h	2021-06-02 05:38:59.000000000 -0400
@@ -0,0 +1,133 @@
+//
+//  SHMediaItem.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+typedef NSString * SHMediaItemProperty NS_TYPED_EXTENSIBLE_ENUM;
+
+/// The Shazam media ID
+SH_EXPORT SHMediaItemProperty const SHMediaItemShazamID;
+
+/// Title
+SH_EXPORT SHMediaItemProperty const SHMediaItemTitle;
+
+/// Subtitle
+SH_EXPORT SHMediaItemProperty const SHMediaItemSubtitle;
+
+/// Artist
+SH_EXPORT SHMediaItemProperty const SHMediaItemArtist;
+
+/// A web URL representing this result
+SH_EXPORT SHMediaItemProperty const SHMediaItemWebURL;
+
+/// The AppleMusic ID
+SH_EXPORT SHMediaItemProperty const SHMediaItemAppleMusicID;
+
+/// A link to this media on Apple Music
+SH_EXPORT SHMediaItemProperty const SHMediaItemAppleMusicURL;
+
+/// A URL to the artwork
+SH_EXPORT SHMediaItemProperty const SHMediaItemArtworkURL;
+
+/// A URL for a Video associated with the media
+SH_EXPORT SHMediaItemProperty const SHMediaItemVideoURL;
+
+/// Is this content explicit
+SH_EXPORT SHMediaItemProperty const SHMediaItemExplicitContent;
+
+/// An array of strings representing the genres of the media item
+SH_EXPORT SHMediaItemProperty const SHMediaItemGenres;
+
+/// The International Standard Recording Code
+SH_EXPORT SHMediaItemProperty const SHMediaItemISRC;
+
+/// @brief @c SHMediaItem represents metadata associated with a @c SHSignature
+/// @discussion A @c SHMediaItem is used in two distinct ways
+///        1. As the base class of a @c SHMatchedMedia item, and therefore as the result of a match
+///     2. As a way of associating metadata with reference signatures in a @c SHCustomCatalog
+///
+/// A SHMediaItem contains no required fields and may be entirely blank, they can also contain custom data set with custom keys when making a @c SHCustomCatalog.
+///
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHMediaItem : NSObject <NSSecureCoding, NSCopying>
+
+/// The Shazam Media ID
+/// @note This may be fetched using the key @c SHMediaItemShazamID
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *shazamID;
+
+/// The Title
+/// @note This may be fetched using the key @c SHMediaItemTitle
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *title;
+
+/// The Subtitle
+/// @note This may be fetched using the key @c SHMediaItemSubtitle
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *subtitle;
+
+/// The Artist
+/// @note This may be fetched using the key @c SHMediaItemArtist
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *artist;
+
+/// The Genre Names
+/// @note This may be fetched using the key @c SHMediaItemGenres
+/// @discussion An array of strings representing the genres of the media item. Will return an empty array if there are no genres.
+@property (NS_NONATOMIC_IOSONLY, strong, readonly) NSArray<NSString *> *genres;
+
+/// The Apple Music ID
+/// @note This may be fetched using the key @c SHMediaItemAppleMusicID
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *appleMusicID;
+
+/// The Apple Music URL
+/// @note This may be fetched using the key @c SHMediaItemAppleMusicURL
+@property (NS_NONATOMIC_IOSONLY, strong, readonly, nullable) NSURL *appleMusicURL;
+
+/// The Web URL
+/// @discussion The URL will point to a page that displays the current object in its entirety
+/// @note This may be fetched using the key @c SHMediaItemWebURL
+@property (NS_NONATOMIC_IOSONLY, strong, readonly, nullable) NSURL *webURL;
+
+/// The Artwork URL
+/// @note This may be fetched using the key @c SHMediaItemArtworkURL
+@property (NS_NONATOMIC_IOSONLY, strong, readonly, nullable) NSURL *artworkURL;
+
+/// The VideoURL
+/// @note This may be fetched using the key @c SHMediaItemVideoURL
+@property (NS_NONATOMIC_IOSONLY, strong, readonly, nullable) NSURL *videoURL;
+
+/// @brief Whether this object represents explicit material
+/// @note This may be fetched using the key @c SHMediaItemExplicitContent
+@property (NS_NONATOMIC_IOSONLY, assign, readonly) BOOL explicitContent;
+
+/// @brief The International Standard Recording Code
+/// @note This may be fetched using the key @c SHMediaItemISRC
+@property (NS_NONATOMIC_IOSONLY, copy, readonly, nullable) NSString *isrc;
+
+/// Construct a new instance with the provided dictionary
+/// @discussion You may add your own keys here to return custom data, custom data should conform to NSCoding
++ (instancetype)mediaItemWithProperties:(NSDictionary<SHMediaItemProperty, id> *)properties;
+
+/// @brief Fetch a @c SHMediaItem by Shazam ID
+/// @discussion The completionHandler will contain a @c SHMediaItem if the ShazamID is valid, otherwise nil and an error
++ (void)fetchMediaItemWithShazamID:(NSString *)shazamID completionHandler:(void (^)(SHMediaItem * __nullable mediaItem, NSError * __nullable error))completionHandler NS_SWIFT_NAME(fetch(shazamID:completionHandler:));
+
+/// Retrieve a value using a known key
+/// @param property The `SHMediaItemProperty` for a value
+- (id)valueForProperty:(SHMediaItemProperty)property NS_SWIFT_UNAVAILABLE("Use subscripting in Swift");
+
+/// Use subscripting to retrieve values
+/// @param key The `SHMediaItemProperty` or custom key for a value
+- (id)objectForKeyedSubscript:(SHMediaItemProperty)key;
+
++ (instancetype)new NS_UNAVAILABLE;
+- (instancetype)init NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaLibrary.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaLibrary.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaLibrary.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHMediaLibrary.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,41 @@
+//
+//  SHMediaLibrary.h
+//  ShazamKit
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+#import <ShazamKit/SHMediaItem.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief @c SHMediaLibrary represents the user's synced Shazam library.
+/// @discussion You can add new @c SHMediaItem instances to the user's library.
+/// Before using any @c SHMediaLibrary method, you must obtain permission from the user to use their Media Library by calling - [MPMediaLibrary requestAuthorization:].
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHMediaLibrary : NSObject
+
+/// @brief Returns an instance of the default Shazam library.
+@property (class, NS_NONATOMIC_IOSONLY, strong, readonly) SHMediaLibrary *defaultLibrary;
+
+/// Adds an array of media items to the user's Shazam library.
+///
+/// @discussion For each @c SHMediaItem instance passed in, the following @c SHMediaItemProperty keys will be saved:
+/// @c SHMediaItemShazamID, @c SHMediaItemTitle, @c SHMediaItemSubtitle.
+/// If @c SHMediaItemSubtitle is not set it may fallback to use @c SHMediaItemArtist if available.
+///
+/// @note @c SHMediaItemShazamID is required for each @c SHMediaItem to be considered valid.
+/// @c SHMediaItemShazamID must be a numeric only string
+///
+/// @param mediaItems An array containing the @c SHMediaItem objects to be added to the library.
+/// @param completionHandler A block called after all valid @c SHMediaItem objects have been added to the library. If an error occurred, the error parameter will be populated.
+- (void)addMediaItems:(NSArray<SHMediaItem *> *)mediaItems completionHandler:(void (^)(NSError * __nullable error))completionHandler;
+
+- (instancetype)init NS_UNAVAILABLE;
++ (instancetype)new NS_UNAVAILABLE;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSession.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSession.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSession.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSession.h	2021-06-02 12:45:21.000000000 -0400
@@ -0,0 +1,83 @@
+//
+//  SHSession.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <AVFAudio/AVFAudio.h>
+#import <ShazamKit/SHDefines.h>
+#import <ShazamKit/SHCatalog.h>
+#import <ShazamKit/SHSignature.h>
+#import <ShazamKit/SHMatch.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+@class SHSession;
+
+/// All communication about matches is performed through this delegate.
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@protocol SHSessionDelegate <NSObject>
+
+@optional
+
+/// @brief A match was found in the @c SHCatalog for the provided @c SHSignature
+/// @param session The @c SHSession that made the match
+/// @param match The @c SHMatch of the matching audio
+- (void)session:(SHSession *)session didFindMatch:(SHMatch *)match;
+
+/// @brief The @c SHSignature did not match anything
+/// @param session The @c SHSession that attempted to match the @c SHSignature
+/// @param signature The @c SHSignature that did not match
+/// @param error An optional error. If simply no match was found this will be set to nil. It will be populated if there was an issue performing the match
+- (void)session:(SHSession *)session didNotFindMatchForSignature:(SHSignature *)signature error:(nullable NSError *)error;
+
+@end
+
+/// @brief A @c SHSession matches instances of @c SHSignature against a @c SHCatalog
+///
+/// @discussion A @c SHSession can be used in two distinct ways to match against a @c SHCatalog
+///
+/// 1. Pass a @c SHSignature to the -[SHSession matchSignature:] method and respond to matches sent to the delegate
+///      There is a 1 to 1 relationship between calls to this method and calls to the delegate
+/// 2. Pass a continuous stream of @c AVAudioPCMBuffer to the -[SHSession matchStreamingBuffer:atTime:] method, matches are sent to the delegate.
+///        ShazamKit will convert the buffers in SHSignature objects internally and perform matches against the @c SHCatalog. The details of how the matching
+///        is performed is an implementation detail and is subject to change. As such there will be many callbacks to the delegate per stream of audio, and the same match
+///        may be reported multiple times in succession.
+///
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHSession : NSObject
+
+/// @brief The @c SHCatalog used to initialize this session and which all matches will be made against
+@property (NS_NONATOMIC_IOSONLY, strong, readonly) SHCatalog *catalog;
+
+/// @brief A delegate for communicating the results of matching
+@property (NS_NONATOMIC_IOSONLY, weak) id<SHSessionDelegate> delegate;
+
+/// Create A new @c SHSession that searches the Shazam Catalog
+- (instancetype)init;
+
+/// Create A new @c SHSession based upon the supplied @c SHCatalog
+/// @param catalog The store of signatures to match against
+- (instancetype)initWithCatalog:(SHCatalog *)catalog;
+
+/// @brief Flow audio buffers for matching into the session
+/// @discussion Audio will be converted into signatures and matched against the store. Results are communicated through the delegate.
+/// The initial buffer specifies the @c AVAudioFormat and all subsequent buffers must contain the same format otherwise an error will be communicated through
+/// the delegate.
+///
+/// It is advisable but not required to pass an @c AVAudioTime along with the audio buffer. The audio provided must be contiguous, gaps in the audio will have adverse
+/// effects on the ability to match the audio. The time variable is validated by the session to ensure that the audio is contiguous and mitigate the effect of discontiguous audio.
+/// @param buffer A buffer of audio to be used for recognition
+/// @param time Where in the stream the audio occurs
+/// @note This method will throw an exception if the audio format is not PCM in one of the following sample rates: 48000, 44100, 32000, 16000.
+- (void)matchStreamingBuffer:(AVAudioPCMBuffer *)buffer atTime:(nullable AVAudioTime *)time;
+
+/// Match the @c SHSignature against the provided @c SHCatalog
+/// @param signature a @c SHSignature to be matched
+- (void)matchSignature:(SHSignature *)signature;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignature.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignature.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignature.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignature.h	2021-06-02 11:08:08.000000000 -0400
@@ -0,0 +1,50 @@
+//
+//  SHSignature.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <ShazamKit/SHDefines.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief The @c SHSignature class is an opaque data container that can be used to store recognition data.
+/// @discussion Signatures are a compact lossy representation of the original audio. The original audio cannot
+/// be recreated from a Signature, there exists only enough data to confirm that the signature matches a certain piece of audio
+/// when it is also converted into a Signature. It is similar in utility to a hashing function.
+///
+/// Signatures can be matched against any type of audio not just music. The only requirement for a match is that the reference and query
+/// Signatures both contain the exact same pre recorded audio e.g. a live rendition of a song will not match against a studio recorded performance
+/// of the same piece.
+///
+/// There are exceptions to the requirement for exactly matching audio, a signature is robust against slight changes in frequency and speed.
+///
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHSignature : NSObject <NSSecureCoding, NSCopying>
+
+/// @brief The duration of the input audio that this signature is derived from
+///
+/// @discussion The duration may not match the source audio duration exactly, audio that contains portions of silence may
+/// report shorter durations
+@property(NS_NONATOMIC_IOSONLY, assign, readonly) NSTimeInterval duration;
+
+/// The raw data that comprises this signature, this is not audio data
+@property(NS_NONATOMIC_IOSONLY, strong, readonly) NSData *dataRepresentation;
+
+/// Create a Signature from Signature data
+/// @param dataRepresentation Signature data generated by Shazam, this is not raw audio data
+/// @param error Error if the data was invalid
+/// @return A signature if the data contained a valid signature, nil otherwise
++ (nullable SHSignature *)signatureWithDataRepresentation:(NSData *)dataRepresentation error:(NSError **)error;
+
+/// Create a Signature from Signature data
+/// @param dataRepresentation Signature data generated by Shazam, this is not raw audio data
+/// @param error Error if the data was invalid
+/// @return A signature if the data contained a valid signature, nil otherwise
+- (nullable instancetype)initWithDataRepresentation:(NSData *)dataRepresentation error:(NSError **)error NS_DESIGNATED_INITIALIZER;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignatureGenerator.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignatureGenerator.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignatureGenerator.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/SHSignatureGenerator.h	2021-06-02 11:08:09.000000000 -0400
@@ -0,0 +1,34 @@
+//
+//  SHSignatureGenerator.h
+//  ShazamKit
+//
+//  Copyright © 2020 Apple Inc. All rights reserved.
+//
+
+#import <Foundation/Foundation.h>
+#import <AVFAudio/AVFAudio.h>
+#import <ShazamKit/SHSignature.h>
+
+NS_ASSUME_NONNULL_BEGIN
+
+/// @brief @c SHSignatureGenerator provides a way to convert audio data into instances of @c SHSignature
+SH_EXPORT API_AVAILABLE(macos(12.0), ios(15.0), tvos(15.0), watchos(8.0))
+@interface SHSignatureGenerator : NSObject
+
+/// @brief Add audio to the generator
+/// @discussion Audio passed to the generator should be contiguous, passing non contiguous data will affect the quality of the @c SHSignature
+/// produced. Passing the @c AVAudioTime is not required but recommended, it allows the generator to detect when the audio is not contiguous.
+/// This method will throw an exception if the audio format is not PCM in one of the following sample rates: 48000, 44100, 32000, 16000.
+/// @param time Where in the stream the audio represents
+/// @param buffer The audio data to be appended to the signature
+/// @param error An error if there was an issue appending the buffer
+- (BOOL)appendBuffer:(AVAudioPCMBuffer *)buffer atTime:(nullable AVAudioTime *)time error:(NSError **)error;
+
+/// @brief Convert the current audio data into a @c SHSignature
+/// @discussion Signature may be called as many times as needed, each time producing a @c SHSignature from
+/// the audio data
+- (SHSignature *)signature;
+
+@end
+
+NS_ASSUME_NONNULL_END
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.apinotes /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.apinotes
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.apinotes	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.apinotes	2021-06-01 21:10:48.000000000 -0400
@@ -0,0 +1,5 @@
+---
+Name: ShazamKit
+Tags:
+- Name: SHErrorCode
+  NSErrorDomain: SHErrorDomain
diff -ruN /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.h /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.h
--- /Applications/Xcode_12.5.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.h	1969-12-31 19:00:00.000000000 -0500
+++ /Applications/Xcode_13.0.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/ShazamKit.framework/Headers/ShazamKit.h	2021-06-01 21:16:53.000000000 -0400
@@ -0,0 +1,24 @@
+//
+//  ShazamKit.h
+//  ShazamKit
+//
+//  Copyright © 2019 Apple Inc. All rights reserved.
+//
+
+/** @framework ShazamKit
+ @abstract A framework for providing Shazam audio recognition functionality
+ */
+
+#import <Foundation/Foundation.h>
+
+#import <ShazamKit/SHCatalog.h>
+#import <ShazamKit/SHCustomCatalog.h>
+#import <ShazamKit/SHDefines.h>
+#import <ShazamKit/SHError.h>
+#import <ShazamKit/SHMatch.h>
+#import <ShazamKit/SHMatchedMediaItem.h>
+#import <ShazamKit/SHMediaItem.h>
+#import <ShazamKit/SHMediaLibrary.h>
+#import <ShazamKit/SHSession.h>
+#import <ShazamKit/SHSignature.h>
+#import <ShazamKit/SHSignatureGenerator.h>
Clone this wiki locally