DMSAudioReader


@interface DMSAudioReader : DMSReader

Audio readers synchronously process images and will return an array of payload classes that reflect the results found. An audio reader takes a CMSampleBuffer as input.

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

    Declaration

    Objective-C

    - (nullable instancetype)
        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. No keys are currently defined.

    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 instancetype)
        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. No keys are currently defined.

    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.

  • Processes a single sample buffer and returns either an empty array, or an array of results as payload objects.

    Declaration

    Objective-C

    - (nullable DMSReaderResult *)
        processSampleBuffer:(nonnull CMSampleBufferRef)buffer
                      error:(NSError *_Nonnull *_Nullable)error;

    Swift

    func process(sampleBuffer buffer: CMSampleBuffer) throws -> ReaderResult

    Parameters

    buffer

    The sample buffer to process.

    error

    An error resulting from processing the sample buffer. Examples of errors include being unable to handle the CMSampleBuffer, or being passed a sample buffer that does not contain an image.

    Return Value

    A reader result containing zero or more payloads. Returns null if an error occurred.

  • 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()
  • 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.

  • Processes a single audio buffer and returns either an empty array, or an array of results as payload objects.

    Declaration

    Objective-C

    - (nullable DMSReaderResult *)processAudioBuffer:(nonnull AVAudioBuffer *)buffer
                                               error:(NSError *_Nullable *_Nullable)
                                                         error;

    Swift

    func process(audioBuffer buffer: AVAudioBuffer) throws -> ReaderResult

    Parameters

    buffer

    The audio buffer to process.

    error

    An error resulting from processing the sample buffer.

    Return Value

    A reader result containing zero or more payloads. Returns null if an error occurred.

  • Processes an Audio Buffer List, and returns a reader result containing zero or more payloads.

    Declaration

    Objective-C

    - (nullable DMSReaderResult *)
        processAudioBufferList:(nonnull const AudioBufferList *)bufferList
             streamDescription:
                 (nonnull const AudioStreamBasicDescription *)streamDescription
                    frameCount:(UInt32)frameCount
                         error:(NSError *_Nullable *_Nullable)error;

    Swift

    func process(audioBufferList bufferList: UnsafePointer<AudioBufferList>, streamDescription: UnsafePointer<AudioStreamBasicDescription>, frameCount: UInt32) throws -> ReaderResult

    Parameters

    bufferList

    The audio buffer to process.

    streamDescription

    A strean description for the bufferList.

    frameCount

    The number of frames in the buffer list.

    error

    An error resulting from processing the sample buffer.

    Return Value

    A reader result containing zero or more payloads. Returns null if an error occurred.

  • The symbologies to use for detection.

    Declaration

    Objective-C

    @property (readonly) DMSSymbologies symbologies;

    Swift

    var symbologies: Symbologies { get }