Class SHSession

  • All Implemented Interfaces:
    NSObject

    public class SHSession
    extends NSObject
    A @c SHSession matches instances of @c SHSignature against a @c SHCatalog 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. API-Since: 15.0
    • Constructor Detail

      • SHSession

        protected SHSession​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static SHSession allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • catalog

        @NotNull
        public @NotNull SHCatalog catalog()
        The @c SHCatalog used to initialize this session and which all matches will be made against
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • delegate

        @Nullable
        public @Nullable SHSessionDelegate delegate()
        A delegate for communicating the results of matching
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • init

        public SHSession init()
        Create A new @c SHSession that searches the Shazam Catalog
        Overrides:
        init in class NSObject
      • initWithCatalog

        public SHSession initWithCatalog​(@NotNull
                                         @NotNull SHCatalog catalog)
        Create A new @c SHSession based upon the supplied @c SHCatalog
        Parameters:
        catalog - The store of signatures to match against
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • matchSignature

        public void matchSignature​(@NotNull
                                   @NotNull SHSignature signature)
        Match the @c SHSignature against the provided @c SHCatalog
        Parameters:
        signature - a @c SHSignature to be matched
      • matchStreamingBufferAtTime

        public void matchStreamingBufferAtTime​(@NotNull
                                               @NotNull AVAudioPCMBuffer buffer,
                                               @Nullable
                                               @Nullable AVAudioTime time)
        Flow audio buffers for matching into the session Audio will be converted into signatures and matched against the @c SHCatalog. 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. [@note] This method only accepts PCM audio formats. The following sample rates are recommended but not required: 48000, 44100, 32000, 16000.
        Parameters:
        buffer - A buffer of audio to be used for recognition
        time - Where in the stream the audio occurs
      • new_objc

        public static SHSession new_objc()
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • setDelegate_unsafe

        public void setDelegate_unsafe​(@Nullable
                                       @Nullable SHSessionDelegate value)
        A delegate for communicating the results of matching
      • setDelegate

        public void setDelegate​(@Nullable
                                @Nullable SHSessionDelegate value)
        A delegate for communicating the results of matching
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • version_static

        public static long version_static()
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.