Class AVAudioFormat

  • All Implemented Interfaces:
    NSCoding, NSSecureCoding, NSObject

    public class AVAudioFormat
    extends NSObject
    implements NSSecureCoding
    AVAudioFormat A representation of an audio format. AVAudioFormat wraps a Core Audio AudioStreamBasicDescription struct, with convenience initializers and accessors for common formats, including Core Audio's standard deinterleaved 32-bit floating point. Instances of this class are immutable.
    • Constructor Detail

      • AVAudioFormat

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

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

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

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

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

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

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

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

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

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

        public static long hash_static()
      • 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

        public static NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(java.lang.String key)
      • new_objc

        public static java.lang.Object new_objc()
      • resolveClassMethod

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

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

        public static void setVersion_static​(long aVersion)
      • superclass_static

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

        public static boolean supportsSecureCoding()
      • version_static

        public static long version_static()
      • channelCount

        public int channelCount()
        [@property] channelCount The number of channels of audio data.
      • channelLayout

        public AVAudioChannelLayout channelLayout()
        [@property] channelLayout The underlying AVAudioChannelLayout, if any. Only formats with more than 2 channels are required to have channel layouts.
      • commonFormat

        public long commonFormat()
        [@property] commonFormat An `AVAudioCommonFormat` identifying the format
      • formatDescription

        public CMFormatDescriptionRef formatDescription()
        [@property] formatDescription Converts to a CMAudioFormatDescriptionRef, for use with Core Media API's.
      • initStandardFormatWithSampleRateChannelLayout

        public AVAudioFormat initStandardFormatWithSampleRateChannelLayout​(double sampleRate,
                                                                           AVAudioChannelLayout layout)
        initStandardFormatWithSampleRate:channelLayout: Initialize to deinterleaved float with the specified sample rate and channel layout.
        Parameters:
        sampleRate - the sample rate
        layout - the channel layout. must not be nil.
      • initStandardFormatWithSampleRateChannels

        public AVAudioFormat initStandardFormatWithSampleRateChannels​(double sampleRate,
                                                                      int channels)
        initStandardFormatWithSampleRate:channels: Initialize to deinterleaved float with the specified sample rate and channel count. If the format specifies more than 2 channels, this method fails (returns nil).
        Parameters:
        sampleRate - the sample rate
        channels - the channel count
      • initWithCMAudioFormatDescription

        public AVAudioFormat initWithCMAudioFormatDescription​(CMFormatDescriptionRef formatDescription)
        initWithCMAudioFormatDescription: initialize from a CMAudioFormatDescriptionRef. If formatDescription is invalid, this method fails (returns nil).
        Parameters:
        formatDescription - the CMAudioFormatDescriptionRef.
      • initWithCommonFormatSampleRateChannelsInterleaved

        public AVAudioFormat initWithCommonFormatSampleRateChannelsInterleaved​(long format,
                                                                               double sampleRate,
                                                                               int channels,
                                                                               boolean interleaved)
        initWithCommonFormat:sampleRate:channels:interleaved: Initialize to float with the specified sample rate, channel count and interleavedness. If the format specifies more than 2 channels, this method fails (returns nil).
        Parameters:
        format - the common format type
        sampleRate - the sample rate
        channels - the channel count
        interleaved - true if interleaved
      • initWithCommonFormatSampleRateInterleavedChannelLayout

        public AVAudioFormat initWithCommonFormatSampleRateInterleavedChannelLayout​(long format,
                                                                                    double sampleRate,
                                                                                    boolean interleaved,
                                                                                    AVAudioChannelLayout layout)
        initWithCommonFormat:sampleRate:interleaved:channelLayout: Initialize to float with the specified sample rate, channel layout and interleavedness.
        Parameters:
        format - the common format type
        sampleRate - the sample rate
        interleaved - true if interleaved
        layout - the channel layout. must not be nil.
      • initWithSettings

        public AVAudioFormat initWithSettings​(NSDictionary<java.lang.String,​?> settings)
        initWithSettings: Initialize using a settings dictionary. See AVAudioSettings.h. Note that many settings dictionary elements pertain to encoder settings, not the basic format, and will be ignored. Returns nil if a format cannot be constructed with the provided settings, e.g. when: - AVNumberOfChannelsKey specifies more than 2 channels, but AVChannelLayoutKey hasn't been specified or the layout does not match - AVLinearPCMBitDepthKey for linear PCM format specifies less than 8 or greater than 32 bits - values for the keys are not of the expected types
      • initWithStreamDescription

        public AVAudioFormat initWithStreamDescription​(AudioStreamBasicDescription asbd)
        initWithStreamDescription: Initialize from an AudioStreamBasicDescription. If the format specifies more than 2 channels, this method fails (returns nil).
        Parameters:
        asbd - the AudioStreamBasicDescription
      • initWithStreamDescriptionChannelLayout

        public AVAudioFormat initWithStreamDescriptionChannelLayout​(AudioStreamBasicDescription asbd,
                                                                    AVAudioChannelLayout layout)
        initWithStreamDescription:channelLayout: Initialize from an AudioStreamBasicDescription and optional channel layout. If the format specifies more than 2 channels, this method fails (returns nil) unless layout is non-nil.
        Parameters:
        asbd - the AudioStreamBasicDescription
        layout - the channel layout. Can be nil only if asbd specifies 1 or 2 channels.
      • isEqual

        public boolean isEqual​(java.lang.Object object)
        isEqual: Determine whether another format is functionally equivalent. For PCM, interleavedness is ignored for mono. Differences in the AudioStreamBasicDescription alignment and packedness are ignored when they are not significant (e.g. with 1 channel, 2 bytes per frame and 16 bits per channel, neither alignment, the format is implicitly packed and can be interpreted as either high- or low-aligned.) For AVAudioChannelLayout, a layout with standard mono/stereo tag is considered to be equivalent to a nil layout. Otherwise, the layouts are compared for equality.
        Specified by:
        isEqual in interface NSObject
        Overrides:
        isEqual in class NSObject
        Parameters:
        object - the format to compare against
      • isInterleaved

        public boolean isInterleaved()
        [@property] interleaved Describes whether the samples are interleaved. For non-PCM formats, the value is undefined.
      • isStandard

        public boolean isStandard()
        [@property] standard Describes whether the format is deinterleaved native-endian float.
      • magicCookie

        public NSData magicCookie()
        [@property] magicCookie The underlying magic cookie, if any. A magic cookie contains metadata associated with encoders and decoders. Encoders produce a magic cookie, and some decoders require a magic cookie to decode properly.
      • sampleRate

        public double sampleRate()
        [@property] sampleRate A sampling rate in Hertz.
      • setMagicCookie

        public void setMagicCookie​(NSData value)
        [@property] magicCookie The underlying magic cookie, if any. A magic cookie contains metadata associated with encoders and decoders. Encoders produce a magic cookie, and some decoders require a magic cookie to decode properly.
      • settings

        public NSDictionary<java.lang.String,​?> settings()
        [@property] settings Returns the format represented as a dictionary with keys from AVAudioSettings.h.
      • streamDescription

        public AudioStreamBasicDescription streamDescription()
        [@property] streamDescription Returns the AudioStreamBasicDescription, for use with lower-level audio API's.
      • _supportsSecureCoding

        public boolean _supportsSecureCoding()
        Description copied from interface: NSSecureCoding
        This property must return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. The Secure Coding Guide should be consulted when writing methods that decode data.
        Specified by:
        _supportsSecureCoding in interface NSSecureCoding