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:(nonnull NSDictionary<DMSReaderOptionKey, id> *)options error:(NSError *_Nullable *_Nullable)error;Swift
init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:]) throwsParameters
symbologiesThe set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set.
optionsA dictionary of options for the reader. No keys are currently defined.
errorAn 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:(nonnull NSDictionary<DMSReaderOptionKey, id> *)options APIKey:(nullable NSString *)APIKey error:(NSError *_Nullable *_Nullable)error;Swift
init(symbologies: Symbologies, options: [ReaderOptionKey : Any] = [:], apiKey APIKey: String?) throwsParameters
symbologiesThe set of symbologies the reader should attempt to detect. This is defined by the DMSSymbology set.
optionsA dictionary of options for the reader. No keys are currently defined.
APIKeyCustom API key to use. Will override any other currently set API key.
errorAn 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 -> ReaderResultParameters
bufferThe sample buffer to process.
errorAn 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] = [:]) throwsParameters
symbologiesSymbologies to configure the reader to detect.
optionsOptions to configure the reader with.
errorAn 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 -> ReaderResultParameters
bufferThe audio buffer to process.
errorAn 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 -> ReaderResultParameters
bufferListThe audio buffer to process.
streamDescriptionA strean description for the bufferList.
frameCountThe number of frames in the buffer list.
errorAn 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 }
DMSAudioReader Class Reference