AudioSettings

class AudioSettings : NSObject

音声入出力の設定クラス

  • 現在使用されているAVAudioSessionCategoryOptions設定を返します。

    Declaration

    Swift

    class func currentCategoryOptions() -> AVAudioSession.CategoryOptions

    Return Value

    現在使用されているAVAudioSessionCategoryOptions

  • 音声出力先についての設定ができます。任意のタイミングで設定が可能です。

    デフォルトの値はAVAudioSessionCategoryOptionMixWithOthersですが、音声が疎通するとAVAudioSessionCategoryOptionAllowBluetoothとなります。

    ビルトインスピーカに切り替えたい場合は、AVAudioSessionCategoryOptionsDefaultToSpeakerを指定してください。

    Declaration

    Swift

    class func setCategoryOptions(_ options: AVAudioSession.CategoryOptions) -> Bool

    Parameters

    options

    AVAudioSessionCategoryOptions

    Return Value

    設定の更新に成功したかどうか

  • 現在設定されている優先サンプルレートを返します。

    Declaration

    Swift

    class func currentPreferredSampleRate() -> Double

    Return Value

    現在設定されている優先サンプルレート

  • 音声の優先サンプルレートを設定します。音声が疎通するタイミングで設定されている値が使用されます。

    ノイズ抑制機能をご利用の場合、通話品質および処理の最適化のために16000を指定するのが望ましいです。

    特定のデバイスを使用する場合等、実際のサンプルレートは異なる場合があります。

    Declaration

    Swift

    class func setPreferredSampleRate(_ preferredSampleRate: Double) -> Bool

    Parameters

    preferredSampleRate

    優先サンプルレート

    Return Value

    設定の更新に成功したかどうか