AudioCaptureSession
public class AudioCaptureSession : NSObject
音声データを取得するためのセッションクラス。 指定した音声フォーマットで音声サンプルを取得することができます。
-
音声取得時の音声フォーマットのデフォルト値(
.pcmInt16
)。Declaration
Swift
public static let DEFAULT_SESSION_FORMAT: IntdashAudioFormat
-
音声取得時のサンプリングレートのデフォルト値 ( 48000 )。
Declaration
Swift
public static let DEFAULT_SAMPLE_RATE: Double
-
音声取得時のチャンネル数のデフォルト値 ( 1チャンネル )。
Declaration
Swift
public static let DEFAULT_CHANNELS: Int
-
音声フォーマット。
Declaration
Swift
public private(set) var audioFormat: IntdashAudioFormat
-
サンプリングレート。
Declaration
Swift
public private(set) var sampleRate: Double
-
チャンネル数。
Declaration
Swift
public private(set) var channels: Int
-
オブジェクトを識別するためのタグ。
Declaration
Swift
public var tag: Int
-
このクラスが使用する Delegate。
Declaration
Swift
public weak var delegate: AudioCaptureSessionDelegate?
-
AudioCaptureSession を生成します。
Declaration
Swift
public init(commonFormat: AVAudioCommonFormat, sampleRate: Double = AudioCaptureSession.DEFAULT_SAMPLE_RATE, channels: Int = AudioCaptureSession.DEFAULT_CHANNELS) throws
Parameters
commonFormat
音声フォーマット
sampleRate
サンプリングレート
channels
チャンネル数
-
AudioCaptureSession を生成します。
Declaration
Swift
public init(audioFormat: IntdashAudioFormat = AudioCaptureSession.DEFAULT_SESSION_FORMAT, sampleRate: Double = AudioCaptureSession.DEFAULT_SAMPLE_RATE, channels: Int = AudioCaptureSession.DEFAULT_CHANNELS) throws
Parameters
audioFormat
音声フォーマット
sampleRate
サンプリングレート
channels
チャンネル数
-
各種設定をセットします。
Declaration
Swift
public func set(commonFormat: AVAudioCommonFormat, sampleRate: Double = AudioCaptureSession.DEFAULT_SAMPLE_RATE, channels: Int = AudioCaptureSession.DEFAULT_CHANNELS) throws
Parameters
commonFormat
音声フォーマット
sampleRate
サンプリングレート
channels
チャンネル数
-
各種設定をセットします。
Declaration
Swift
public func set(audioFormat: IntdashAudioFormat = AudioCaptureSession.DEFAULT_SESSION_FORMAT, sampleRate: Double = AudioCaptureSession.DEFAULT_SAMPLE_RATE, channels: Int = AudioCaptureSession.DEFAULT_CHANNELS) throws
Parameters
audioFormat
音声フォーマット
sampleRate
サンプリングレート
channels
チャンネル数
-
処理を開始します。
Declaration
Swift
public func startRunning(completion: @escaping (_ result: Bool) -> ())
Parameters
completion
処理完了時のコールバック
result
処理成功、失敗フラグ
-
処理を終了します。
Declaration
Swift
public func stopRunning(_ completion: (() -> ())? = nil)
Parameters
completion
処理完了時のコールバック
-
割り当てを解除します。
Declaration
Swift
public func dispose()