OpusEncoder

public class OpusEncoder : NSObject

Opus用のエンコーダークラス。

  • エンコード時の帯域のデフォルト値( .fb20000Hz )。

    Declaration

    Swift

    public static let DEFAULT_BANDWIDTH: OpusHeader.BandWidth
  • エンコード時のフレームサイズのデフォルト値( 20ms )。

    Declaration

    Swift

    public static let DEFAULT_FRAME_DURATION: OpusHeader.FrameDuration
  • エンコード時のビットレートのデフォルト値( 64000 )。

    Declaration

    Swift

    public static let DEFAULT_BIT_RATE: Int
  • エンコード時のチャンネル数のデフォルト値( 1チャンネル )。

    Declaration

    Swift

    public static let DEFAULT_CHANNELS: Int
  • tag

    オブジェクトを識別するためのタグ。

    Declaration

    Swift

    public var tag: Int
  • このクラスが使用する Delegate。

    Declaration

    Swift

    public weak var delegate: OpusEncoderDelegate?
  • 入力に使用した音声フォーマット。

    Declaration

    Swift

    public private(set) var inputFormatDesc: AudioStreamBasicDescription?
  • 出力される音声フォーマット。

    Declaration

    Swift

    public private(set) var outputFormatDesc: AudioStreamBasicDescription?
  • 帯域幅。

    Declaration

    Swift

    public let bandWidth: OpusHeader.BandWidth
  • サンプリングレート。

    Declaration

    Swift

    public var sampleRate: Double { get }
  • 1フレームの長さ。

    Declaration

    Swift

    public var frameDuration: OpusHeader.FrameDuration
  • ビットレート。

    Declaration

    Swift

    public private(set) var bitRate: Int
  • チャンネル数。

    Declaration

    Swift

    public let channels: Int
  • OpusEncoder を生成します。

    Declaration

    Swift

    public init(bandWidth: OpusHeader.BandWidth = OpusEncoder.DEFAULT_BANDWIDTH, frameDuration: OpusHeader.FrameDuration = OpusEncoder.DEFAULT_FRAME_DURATION, bitRate: Int = OpusEncoder.DEFAULT_BIT_RATE, channels: Int = OpusEncoder.DEFAULT_CHANNELS)

    Parameters

    bandWidth

    帯域幅

    frameDuration

    1フレームの長さ

    bitRate

    ビットレート

    channels

    チャンネル数

  • エンコードしたい音声サンプルを追加します。

    Declaration

    Swift

    public func appendSampleBuffer(sampleBuffer: CMSampleBuffer, timestamp: TimeInterval)

    Parameters

    sampleBuffer

    エンコードしたい音声サンプルを格納したバッファー
    入力するサンプルバッファーの音声フォーマットは pcmFloat32 のみサポートしています。

    timestamp

    タイムスタンプ

  • ビットレートを設定します。

    Declaration

    Swift

    public func set(bitRate: Int)

    Parameters

    bitRate

    ビットレート

  • 初期状態にリセットします。

    Declaration

    Swift

    public func reset()
  • 割り当てを解除します。

    Declaration

    Swift

    public func dispose()