DMSAudioCaptureReader


@interface DMSAudioCaptureReader : DMSCaptureReader

The audio capture reader interface is ideal for real-time capture from an audio source such as a microphone. It vends a captureOutput that can be hooked to an existing AVFoundation capture tree. An audio capture reader will automatically perform buffering and optimization necessary for a capture source. For situations in which a developer wants to have deeper control of how audio is buffered or staged for detection, the synchronous audio reader interface should be used.

  • Custom initializer for a new image reader for the given symbologies.

    Declaration

    Objective-C

    - (nullable id)
        initWithSymbologies:(DMSSymbologies)symbologies
                    options:(NSDictionary<DMSReaderOptionKey, id> *_Nonnull)options
                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throws

    Parameters

    symbologies

    The set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set.

    options

    A dictionary of options for the reader.

    error

    An error returned by this function. Typically returned if a set of options is inconsistent, or if the current or supplied license key is invalid.

    Return Value

    Returns a new audio detector. May return nil.

  • Designated initializer for a new image reader for the given symbologies.

    Declaration

    Objective-C

    - (nullable id)
        initWithSymbologies:(DMSSymbologies)symbologies
                    options:(NSDictionary<DMSReaderOptionKey, id> *_Nonnull)options
                     APIKey:(NSString *_Nullable)APIKey
                      error:(NSError *_Nullable *_Nullable)error;

    Swift

    init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:], apiKey APIKey: String?) throws

    Parameters

    symbologies

    The set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set.

    options

    A dictionary of options for the reader.

    APIKey

    Custom API key to use. Will override any other currently set API key.

    error

    An error returned by this function. Typically returned if a set of options is inconsistent, or if the current or supplied license key is invalid.

    Return Value

    Returns a new audio detector. May return nil.

  • Sets the delegate to deliver results to.

    Declaration

    Objective-C

    - (void)setResultsDelegate:
                (nullable NSObject<DMSAudioCaptureReaderResultsDelegate> *)delegate
                         queue:(nullable dispatch_queue_t)queue;

    Swift

    func setResultsDelegate(_ delegate: AudioCaptureReaderResultsDelegate?, queue: DispatchQueue?)

    Parameters

    delegate

    A delegate to deliver results to.

    queue

    The queue to return results onto. Applications that need to do UI tasks in response to a detection may want to pass the main queue. If delegate is not nil, passing nil for this argument will cause an exception. If delegate is nil, this argument may be ignored.

  • Returns the results delegate. Will be nil if a delegate has not been set.

    Declaration

    Objective-C

    @property (atomic, weak, readonly, nullable)
        NSObject<DMSAudioCaptureReaderResultsDelegate> *resultsDelegate;

    Swift

    weak var resultsDelegate: AudioCaptureReaderResultsDelegate? { get }
  • Returns the queue results will be delivered on. Will be nil if a queue has not been set.

    Declaration

    Objective-C

    @property (atomic, readonly, nullable) dispatch_queue_t resultsQueue;

    Swift

    var resultsQueue: DispatchQueue? { get }
  • The symbologies to use for detection

    Declaration

    Objective-C

    @property (atomic, readonly) DMSSymbologies symbologies;

    Swift

    var symbologies: Symbologies { get }
  • Sets symbologies and reader options.

    Declaration

    Objective-C

    - (BOOL)setSymbologies:(DMSSymbologies)symbologies
                   options:(nonnull NSDictionary<DMSReaderOptionKey, id> *)options
                     error:(NSError *_Nullable *_Nullable)error;

    Swift

    func setSymbologies(_ symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throws

    Parameters

    symbologies

    Symbologies to configure the reader to detect.

    options

    Options to configure the reader with.

    error

    An error resulting from setting symbologies, if any.

  • Resets the reader to its default state. Any previously detected payloads will be reported as new payloads again.

    Declaration

    Objective-C

    - (void)reset;

    Swift

    func reset()