:github_url: hide .. DO NOT EDIT THIS FILE!!! .. Generated automatically from Godot engine sources. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py. .. XML source: https://github.com/godotengine/godot/tree/master/../../GodotApplePlugins/doc_classes/AVAudioSession.xml. .. _class_AVAudioSession: AVAudioSession ============== **Inherits:** :ref:`RefCounted` **<** :ref:`Object` Controls the shared iOS/tvOS audio session from GDScript. .. rst-class:: classref-introduction-group Description ----------- Use this helper to select one of Apple's predefined ``AVAudioSession`` categories so your Godot project can mix or duck audio according to platform expectations. It is most useful on mobile builds where the engine needs to share the audio device with the system music player or with voice chat as described in ``GameCenterGuide.md``. See Apple's audio session overview at `Apple's AVAudioSession reference `__. .. rst-class:: classref-reftable-group Properties ---------- .. table:: :widths: auto +-----------------------+---------------------------------------------------------+-------+ | :ref:`int` | :ref:`category` | ``6`` | +-----------------------+---------------------------------------------------------+-------+ .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Enumerations ------------ .. _enum_AVAudioSession_SessionCategory: .. rst-class:: classref-enumeration enum **SessionCategory**: :ref:`🔗` .. _class_AVAudioSession_constant_ambient: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **ambient** = ``0`` Plays audio quietly and mixes with other apps, ideal for games that should respect background music. .. _class_AVAudioSession_constant_multiRoute: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **multiRoute** = ``1`` Allows simultaneous input and output on multiple ports such as iPad USB headsets and speakers. .. _class_AVAudioSession_constant_playAndRecord: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **playAndRecord** = ``2`` Enables full duplex audio for gameplay that records the microphone while playing effects. .. _class_AVAudioSession_constant_playback: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **playback** = ``3`` Optimised for playback only and silences system music while your game is active. .. _class_AVAudioSession_constant_record: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **record** = ``4`` Recording-only mode for utilities that only capture audio. .. _class_AVAudioSession_constant_soloAmbient: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **soloAmbient** = ``5`` Similar to :ref:`ambient` but pauses other audio sessions when your project starts. .. _class_AVAudioSession_constant_unknown: .. rst-class:: classref-enumeration-constant :ref:`SessionCategory` **unknown** = ``6`` Default fallback when the platform does not expose audio sessions (macOS desktop). .. rst-class:: classref-section-separator ---- .. rst-class:: classref-descriptions-group Property Descriptions --------------------- .. _class_AVAudioSession_property_category: .. rst-class:: classref-property :ref:`int` **category** = ``6`` :ref:`🔗` .. rst-class:: classref-property-setget - |void| **set_category**\ (\ value\: :ref:`int`\ ) - :ref:`int` **get_category**\ (\ ) Selects the Apple audio session category. Use one of the :ref:`SessionCategory` constants to decide whether your game mixes with other apps, records audio, or routes voice chat. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)` .. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)` .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)` .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)` .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)` .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)` .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)` .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)` .. |void| replace:: :abbr:`void (No return value.)`