palace/html/reference.html

1691 lines
87 KiB
HTML
Raw Normal View History

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Reference &#8212; palace 0.0.12 documentation</title>
<link rel="stylesheet" href="_static/alabaster.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
<script src="_static/jquery.js"></script>
<script src="_static/underscore.js"></script>
<script src="_static/doctools.js"></script>
<script src="_static/language_data.js"></script>
<link rel="index" title="Index" href="genindex.html" />
<link rel="search" title="Search" href="search.html" />
<link rel="prev" title="Installation" href="installation.html" />
<link rel="stylesheet" href="_static/custom.css" type="text/css" />
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
</head><body>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body" role="main">
<div class="section" id="reference">
<h1>Reference<a class="headerlink" href="#reference" title="Permalink to this headline"></a></h1>
<div class="toctree-wrapper compound">
</div>
<span class="target" id="module-palace"></span><p>Pythonic Audio Library and Codecs Environment</p>
<dl class="attribute">
<dt id="palace.Vector3">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Vector3</code><a class="headerlink" href="#palace.Vector3" title="Permalink to this definition"></a></dt>
<dd><p>Tuple of three floats.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>Type</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.CHANNEL_CONFIG">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">CHANNEL_CONFIG</code><a class="headerlink" href="#palace.CHANNEL_CONFIG" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the channel configuration
(either <cite>MONO</cite>, <cite>STEREO</cite>, <cite>QUAD</cite>, <cite>X51</cite>, <cite>X61</cite> or <cite>X71</cite>).</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.SAMPLE_TYPE">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">SAMPLE_TYPE</code><a class="headerlink" href="#palace.SAMPLE_TYPE" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the sample type
(either <cite>[UNSIGNED_]{BYTE,SHORT,INT}</cite> or <cite>FLOAT</cite>).</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.FREQUENCY">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">FREQUENCY</code><a class="headerlink" href="#palace.FREQUENCY" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the frequency in hertz.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.MONO_SOURCES">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">MONO_SOURCES</code><a class="headerlink" href="#palace.MONO_SOURCES" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the number of mono (3D) sources.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.STEREO_SOURCES">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">STEREO_SOURCES</code><a class="headerlink" href="#palace.STEREO_SOURCES" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the number of stereo sources.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.MAX_AUXILIARY_SENDS">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">MAX_AUXILIARY_SENDS</code><a class="headerlink" href="#palace.MAX_AUXILIARY_SENDS" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the maximum number of
auxiliary source sends.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.HRTF">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">HRTF</code><a class="headerlink" href="#palace.HRTF" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify whether to enable HRTF
(either <cite>FALSE</cite>, <cite>TRUE</cite> or <cite>DONT_CARE</cite>).</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.HRTF_ID">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">HRTF_ID</code><a class="headerlink" href="#palace.HRTF_ID" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify the HRTF to be used.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.OUTPUT_LIMITER">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">OUTPUT_LIMITER</code><a class="headerlink" href="#palace.OUTPUT_LIMITER" title="Permalink to this definition"></a></dt>
<dd><p>Context creation key to specify whether to use a gain limiter
(either <cite>FALSE</cite>, <cite>TRUE</cite> or <cite>DONT_CARE</cite>).</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>int</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.sample_types">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">sample_types</code><a class="headerlink" href="#palace.sample_types" title="Permalink to this definition"></a></dt>
<dd><p>Names of available sample types.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>Tuple[str, ..]</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.channel_configs">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">channel_configs</code><a class="headerlink" href="#palace.channel_configs" title="Permalink to this definition"></a></dt>
<dd><p>Names of available channel configurations.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>Tuple[str, ..]</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.device_names">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">device_names</code><a class="headerlink" href="#palace.device_names" title="Permalink to this definition"></a></dt>
<dd><p>Read-only namespace of device names by category (basic, full and
capture), as tuples of strings whose first item being the default.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>DeviceNames</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.decoder_factories">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">decoder_factories</code><a class="headerlink" href="#palace.decoder_factories" title="Permalink to this definition"></a></dt>
<dd><p>Simple object for storing decoder factories.</p>
<p>User-registered factories are tried one after another
if <cite>RuntimeError</cite> is raised, in lexicographical order.
Internal decoder factories are always used after registered ones.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>DecoderNamespace</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="palace.sample_size">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">sample_size</code><span class="sig-paren">(</span><em class="sig-param">length: int</em>, <em class="sig-param">str channel_config: str</em>, <em class="sig-param">str sample_type: str</em><span class="sig-paren">)</span> &#x2192; int<a class="headerlink" href="#palace.sample_size" title="Permalink to this definition"></a></dt>
<dd><p>Return the size of the given number of sample frames.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeError</strong> If the byte size result too large.</p>
</dd>
</dl>
</dd></dl>
<dl class="function">
<dt id="palace.sample_length">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">sample_length</code><span class="sig-paren">(</span><em class="sig-param">size: int</em>, <em class="sig-param">str channel_config: str</em>, <em class="sig-param">str sample_type: str</em><span class="sig-paren">)</span> &#x2192; int<a class="headerlink" href="#palace.sample_length" title="Permalink to this definition"></a></dt>
<dd><p>Return the number of frames stored in the given byte size.</p>
</dd></dl>
<dl class="function">
<dt id="palace.query_extension">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">query_extension</code><span class="sig-paren">(</span><em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#palace.query_extension" title="Permalink to this definition"></a></dt>
<dd><p>Return if a non-device-specific ALC extension exists.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.Device.query_extension" title="palace.Device.query_extension"><code class="xref py py-func docutils literal notranslate"><span class="pre">Device.query_extension()</span></code></a></dt><dd><p>Query ALC extension on a device</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="function">
<dt id="palace.current_context">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">current_context</code><span class="sig-paren">(</span><em class="sig-param">thread: bool = False</em><span class="sig-paren">)</span> &#x2192; Optional[Context]<a class="headerlink" href="#palace.current_context" title="Permalink to this definition"></a></dt>
<dd><p>Return the context that is currently used.</p>
<p>If <cite>thread</cite> is set to <cite>True</cite>, return the thread-specific context
used for OpenAL operations. This requires the non-device-specific
as well as the contexts device <cite>ALC_EXT_thread_local_context</cite>
extension to be available.</p>
</dd></dl>
<dl class="function">
<dt id="palace.use_context">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">use_context</code><span class="sig-paren">(</span><em class="sig-param">context: Optional[Context], thread: bool = False</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.use_context" title="Permalink to this definition"></a></dt>
<dd><p>Make the specified context current for OpenAL operations.</p>
<p>If <cite>thread</cite> is set to <cite>True</cite>, make the context current
for OpenAL operations on the calling thread only.
This requires the non-device-specific as well as the contexts
device <a href="#id1"><span class="problematic" id="id2">`</span></a>ALC_EXT_thread_local_context extension to be available.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.Context" title="palace.Context"><code class="xref py py-func docutils literal notranslate"><span class="pre">Context()</span></code></a></dt><dd><p>Audio environment container</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="function">
<dt id="palace.current_fileio">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">current_fileio</code><span class="sig-paren">(</span><span class="sig-paren">)</span> &#x2192; Optional[Callable[[str], FileIO]]<a class="headerlink" href="#palace.current_fileio" title="Permalink to this definition"></a></dt>
<dd><p>Return the file I/O factory currently in used by audio decoders.</p>
<p>If the default is being used, return <cite>None</cite>.</p>
</dd></dl>
<dl class="function">
<dt id="palace.use_fileio">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">use_fileio</code><span class="sig-paren">(</span><em class="sig-param">factory: Optional[Callable[[str], FileIO]], buffer_size: int = DEFAULT_BUFFER_SIZE</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.use_fileio" title="Permalink to this definition"></a></dt>
<dd><p>Set the file I/O factory instance to be used by audio decoders.</p>
<p>If <cite>factory=None</cite> is provided, revert to the default.</p>
</dd></dl>
<dl class="class">
<dt id="palace.Device">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Device</code><span class="sig-paren">(</span><em class="sig-param">str name: str = ''</em>, <em class="sig-param">fallback: Iterable[str] = ()</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Device" title="Permalink to this definition"></a></dt>
<dd><p>Audio mix output, via either a system stream or a hardware port.</p>
<p>This can be used as a context manager that calls <cite>close</cite> upon
completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em><em>, </em><em>optional</em>) The name of the playback device.</p></li>
<li><p><strong>fallback</strong> (<em>Iterable</em><em>[</em><em>str</em><em>]</em><em>, </em><em>optional</em>) Device names to fallback to, default to an empty tuple.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If device creation fails.</p>
</dd>
<dt class="field-odd">Warns</dt>
<dd class="field-odd"><p><strong>RuntimeWarning</strong> Before each fallback.</p>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.device_names" title="palace.device_names"><code class="xref py py-class docutils literal notranslate"><span class="pre">device_names</span></code></a></dt><dd><p>Available device names</p>
</dd>
</dl>
</div>
<dl class="method">
<dt id="palace.Device.alc_version">
<em class="property">property </em><code class="sig-name descname">alc_version</code><a class="headerlink" href="#palace.Device.alc_version" title="Permalink to this definition"></a></dt>
<dd><p>ALC version supported by this device.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.basic_name">
<em class="property">property </em><code class="sig-name descname">basic_name</code><a class="headerlink" href="#palace.Device.basic_name" title="Permalink to this definition"></a></dt>
<dd><p>Basic name of the device.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.clock_time">
<em class="property">property </em><code class="sig-name descname">clock_time</code><a class="headerlink" href="#palace.Device.clock_time" title="Permalink to this definition"></a></dt>
<dd><p>Current clock time for the device.</p>
<p class="rubric">Notes</p>
<p>This starts relative to the device being opened, and does not
increment while there are no contexts nor while processing
is paused. Currently, this may not exactly match the rate
that sources play at. In the future it may utilize an OpenAL
extension to retrieve the audio devices real clock.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.close">
<code class="sig-name descname">close</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Device.close" title="Permalink to this definition"></a></dt>
<dd><p>Close and free the device.</p>
<p>All previously-created contexts must first be destroyed.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.current_hrtf">
<em class="property">property </em><code class="sig-name descname">current_hrtf</code><a class="headerlink" href="#palace.Device.current_hrtf" title="Permalink to this definition"></a></dt>
<dd><p>Name of the HRTF currently being used by this device.</p>
<p>If HRTF is not currently enabled, this will be <cite>None</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.efx_version">
<em class="property">property </em><code class="sig-name descname">efx_version</code><a class="headerlink" href="#palace.Device.efx_version" title="Permalink to this definition"></a></dt>
<dd><p>EFX version supported by this device.</p>
<p>If the <cite>ALC_EXT_EFX</cite> extension is unsupported,
this will be <cite>(0, 0)</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.frequency">
<em class="property">property </em><code class="sig-name descname">frequency</code><a class="headerlink" href="#palace.Device.frequency" title="Permalink to this definition"></a></dt>
<dd><p>Playback frequency in hertz.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.hrtf_enabled">
<em class="property">property </em><code class="sig-name descname">hrtf_enabled</code><a class="headerlink" href="#palace.Device.hrtf_enabled" title="Permalink to this definition"></a></dt>
<dd><p>Whether HRTF is enabled on the device.</p>
<p>If the <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
this will return False although there could still be
HRTF applied at a lower hardware level.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.hrtf_names">
<em class="property">property </em><code class="sig-name descname">hrtf_names</code><a class="headerlink" href="#palace.Device.hrtf_names" title="Permalink to this definition"></a></dt>
<dd><p>List of available HRTF names.</p>
<p>The order is retained from OpenAL, such that the index of
a given name is the ID to use with <cite>ALC_HRTF_ID_SOFT</cite>.</p>
<p>If the <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
this will be an empty list.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.max_auxiliary_sends">
<em class="property">property </em><code class="sig-name descname">max_auxiliary_sends</code><a class="headerlink" href="#palace.Device.max_auxiliary_sends" title="Permalink to this definition"></a></dt>
<dd><p>Maximum number of auxiliary source sends.</p>
<p>If <cite>ALC_EXT_EFX</cite> is unsupported, this will be 0.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.name">
<em class="property">property </em><code class="sig-name descname">name</code><a class="headerlink" href="#palace.Device.name" title="Permalink to this definition"></a></dt>
<dd><p>Name of the device.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.pause_dsp">
<code class="sig-name descname">pause_dsp</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Device.pause_dsp" title="Permalink to this definition"></a></dt>
<dd><p>Pause device processing and stop contexts updates.</p>
<p>Multiple calls are allowed but it is not reference counted,
so the device will resume after one <cite>resume_dsp</cite> call.</p>
<p>This requires the <cite>ALC_SOFT_pause_device</cite> extension.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.query_extension">
<code class="sig-name descname">query_extension</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#palace.Device.query_extension" title="Permalink to this definition"></a></dt>
<dd><p>Return if an ALC extension exists on this device.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.query_extension" title="palace.query_extension"><code class="xref py py-meth docutils literal notranslate"><span class="pre">query_extension()</span></code></a></dt><dd><p>Query non-device-specific ALC extension</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="method">
<dt id="palace.Device.reset">
<code class="sig-name descname">reset</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">attrs: Dict[int</em>, <em class="sig-param">int] = {}</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Device.reset" title="Permalink to this definition"></a></dt>
<dd><p>Reset the device, using the specified attributes.</p>
<p>If the <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
this will be a no-op.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Device.resume_dsp">
<code class="sig-name descname">resume_dsp</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Device.resume_dsp" title="Permalink to this definition"></a></dt>
<dd><p>Resume device processing and restart contexts updates.</p>
<p>Multiple calls are allowed and will no-op.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.Context">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Context</code><span class="sig-paren">(</span><em class="sig-param">Device device: Device</em>, <em class="sig-param">attrs: Dict[int</em>, <em class="sig-param">int] = {}</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Context" title="Permalink to this definition"></a></dt>
<dd><p>Container maintaining the entire audio environment, its settings
and components such as sources, buffers and effects.</p>
<p>This can be used as a context manager, e.g.</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">with</span> <span class="n">context</span><span class="p">:</span>
<span class="o">...</span>
</pre></div>
</div>
<p>is equivalent to</p>
<div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">previous</span> <span class="o">=</span> <span class="n">current_context</span><span class="p">()</span>
<span class="n">use_context</span><span class="p">(</span><span class="n">context</span><span class="p">)</span>
<span class="k">try</span><span class="p">:</span>
<span class="o">...</span>
<span class="k">finally</span><span class="p">:</span>
<span class="n">use_context</span><span class="p">(</span><span class="n">previous</span><span class="p">)</span>
<span class="n">context</span><span class="o">.</span><span class="n">destroy</span><span class="p">()</span>
</pre></div>
</div>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>device</strong> (<a class="reference internal" href="#palace.Device" title="palace.Device"><em>Device</em></a>) The <cite>device</cite> on which the context is to be created.</p></li>
<li><p><strong>attrs</strong> (<em>Dict</em><em>[</em><em>int</em><em>, </em><em>int</em><em>]</em>) Attributes specified for the context to be created.</p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="palace.Context.device">
<code class="sig-name descname">device</code><a class="headerlink" href="#palace.Context.device" title="Permalink to this definition"></a></dt>
<dd><p>The device this context was created from.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p><a class="reference internal" href="#palace.Device" title="palace.Device">Device</a></p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.Context.listener">
<code class="sig-name descname">listener</code><a class="headerlink" href="#palace.Context.listener" title="Permalink to this definition"></a></dt>
<dd><p>The listener instance of this context.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>Listener</p>
</dd>
</dl>
</dd></dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeError</strong> If context creation fails.</p>
</dd>
</dl>
<dl class="attribute">
<dt id="palace.Context.async_wake_interval">
<code class="sig-name descname">async_wake_interval</code><a class="headerlink" href="#palace.Context.async_wake_interval" title="Permalink to this definition"></a></dt>
<dd><p>Current interval used for waking up the background thread.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.available_resamplers">
<em class="property">property </em><code class="sig-name descname">available_resamplers</code><a class="headerlink" href="#palace.Context.available_resamplers" title="Permalink to this definition"></a></dt>
<dd><p>The list of resamplers supported by the context.</p>
<p>If the <cite>AL_SOFT_source_resampler</cite> extension is unsupported
this will be an empty list, otherwise there would be
at least one entry.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.default_resampler_index">
<em class="property">property </em><code class="sig-name descname">default_resampler_index</code><a class="headerlink" href="#palace.Context.default_resampler_index" title="Permalink to this definition"></a></dt>
<dd><p>The contexts default resampler index.</p>
<p>If the <cite>AL_SOFT_source_resampler</cite> extension is unsupported
the resampler list will be empty and this will return 0.</p>
<p>If you try to access the resampler list with this index
without extension, undefined behavior will occur
(accessing an out of bounds array index).</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Context.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Destroy the context.</p>
<p>The context must not be current when this is called.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.doppler_factor">
<em class="property">property </em><code class="sig-name descname">doppler_factor</code><a class="headerlink" href="#palace.Context.doppler_factor" title="Permalink to this definition"></a></dt>
<dd><p>Factor to apply to all sources doppler calculations.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.end_batch">
<code class="sig-name descname">end_batch</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Context.end_batch" title="Permalink to this definition"></a></dt>
<dd><p>Continue processing the context and end batching.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.is_supported">
<code class="sig-name descname">is_supported</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">str channel_config: str</em>, <em class="sig-param">str sample_type: str</em><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#palace.Context.is_supported" title="Permalink to this definition"></a></dt>
<dd><p>Return if the channel configuration and sample type
are supported by the context.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.sample_types" title="palace.sample_types"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sample_types()</span></code></a></dt><dd><p>Set of sample types</p>
</dd>
<dt><a class="reference internal" href="#palace.channel_configs" title="palace.channel_configs"><code class="xref py py-meth docutils literal notranslate"><span class="pre">channel_configs()</span></code></a></dt><dd><p>Set of channel configurations</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="attribute">
<dt id="palace.Context.message_handler">
<code class="sig-name descname">message_handler</code><a class="headerlink" href="#palace.Context.message_handler" title="Permalink to this definition"></a></dt>
<dd><p>Handler of some certain events.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.speed_of_sound">
<em class="property">property </em><code class="sig-name descname">speed_of_sound</code><a class="headerlink" href="#palace.Context.speed_of_sound" title="Permalink to this definition"></a></dt>
<dd><p>The speed of sound propagation in units per second.</p>
<p>It is used to calculate the doppler effect along with other
distance-related time effects.</p>
<p>The default is 343.3 units per second (a realistic speed
assuming 1 meter per unit). If this is adjusted for a
different unit scale, <cite>Listener.meters_per_unit</cite> should
also be adjusted.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.start_batch">
<code class="sig-name descname">start_batch</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Context.start_batch" title="Permalink to this definition"></a></dt>
<dd><p>Suspend the context to start batching.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Context.update">
<code class="sig-name descname">update</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Context.update" title="Permalink to this definition"></a></dt>
<dd><p>Update the context and all sources belonging to this context.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.Buffer">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Buffer</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em>, <em class="sig-param">str name: str</em>, <em class="sig-param">existed: bool = False</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Buffer" title="Permalink to this definition"></a></dt>
<dd><p>Buffer of preloaded PCM samples coming from a <cite>Decoder</cite>.</p>
<p>Cached buffers must be freed using <cite>destroy</cite> before destroying
<cite>context</cite>. Alternatively, this can be used as a context manager
that calls <cite>destroy</cite> upon completion of the block,
even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the buffer is to be created and cached.</p></li>
<li><p><strong>name</strong> (<em>str</em>) Audio file or resource name. Multiple calls with the same name
will return the same buffer.</p></li>
</ul>
</dd>
</dl>
<dl class="attribute">
<dt id="palace.Buffer.name">
<code class="sig-name descname">name</code><a class="headerlink" href="#palace.Buffer.name" title="Permalink to this definition"></a></dt>
<dd><p>Audio file or resource name.</p>
<dl class="field-list simple">
<dt class="field-odd">Type</dt>
<dd class="field-odd"><p>str</p>
</dd>
</dl>
</dd></dl>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeError</strong> If the buffer can neither be loaded
nor be found when <cite>existed</cite> is set.</p>
</dd>
</dl>
<dl class="method">
<dt id="palace.Buffer.channel_config">
<em class="property">property </em><code class="sig-name descname">channel_config</code><a class="headerlink" href="#palace.Buffer.channel_config" title="Permalink to this definition"></a></dt>
<dd><p>Buffers sample configuration.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Buffer.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Free the buffers cache</p>
<p>This invalidates all other <cite>Buffer</cite> objects with the same name.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.frequency">
<em class="property">property </em><code class="sig-name descname">frequency</code><a class="headerlink" href="#palace.Buffer.frequency" title="Permalink to this definition"></a></dt>
<dd><p>Buffers frequency in hertz.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.from_decoder">
<em class="property">static </em><code class="sig-name descname">from_decoder</code><span class="sig-paren">(</span><em class="sig-param">Decoder decoder: Decoder</em>, <em class="sig-param">Context context: Context</em>, <em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; Buffer<a class="headerlink" href="#palace.Buffer.from_decoder" title="Permalink to this definition"></a></dt>
<dd><p>Return a buffer created by reading the given decoder.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>decoder</strong> (<a class="reference internal" href="#palace.Decoder" title="palace.Decoder"><em>Decoder</em></a>) The decoder from which the buffer is to be cached.</p></li>
<li><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the buffer is to be created.</p></li>
<li><p><strong>name</strong> (<em>str</em>) The name to give to the buffer. It may alias an audio file,
but it must not currently exist in the buffer cache.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If the buffer cannot be created.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.length">
<em class="property">property </em><code class="sig-name descname">length</code><a class="headerlink" href="#palace.Buffer.length" title="Permalink to this definition"></a></dt>
<dd><p>Length of the buffer in sample frames.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.length_seconds">
<em class="property">property </em><code class="sig-name descname">length_seconds</code><a class="headerlink" href="#palace.Buffer.length_seconds" title="Permalink to this definition"></a></dt>
<dd><p>Length of the buffer in seconds.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Buffer.loop_points">
<code class="sig-name descname">loop_points</code><a class="headerlink" href="#palace.Buffer.loop_points" title="Permalink to this definition"></a></dt>
<dd><p>Loop points for looping sources.</p>
<p>If the <cite>AL_SOFT_loop_points</cite> extension is not supported by the
current context, <cite>start = 0</cite> and <cite>end = length</cite> respectively.
Otherwise, <cite>start &lt; end &lt;= length</cite>.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>start</strong> (<em>int</em>) Starting point, in sample frames (inclusive).</p></li>
<li><p><strong>end</strong> (<em>int</em>) Ending point, in sample frames (exclusive).</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The buffer must not be in use when this property is set.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.play">
<code class="sig-name descname">play</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">source: Optional[Source] = None</em><span class="sig-paren">)</span> &#x2192; Source<a class="headerlink" href="#palace.Buffer.play" title="Permalink to this definition"></a></dt>
<dd><p>Play <cite>source</cite> using the buffer.</p>
<p>Return the source used for playing. If <cite>None</cite> is given,
create a new one.</p>
<p>One buffer may be played from multiple sources simultaneously.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.sample_type">
<em class="property">property </em><code class="sig-name descname">sample_type</code><a class="headerlink" href="#palace.Buffer.sample_type" title="Permalink to this definition"></a></dt>
<dd><p>Buffers sample type.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.size">
<em class="property">property </em><code class="sig-name descname">size</code><a class="headerlink" href="#palace.Buffer.size" title="Permalink to this definition"></a></dt>
<dd><p>Storage size used by the buffer, in bytes.</p>
<p class="rubric">Notes</p>
<p>The size in bytes may not be what you expect from the length,
as it may take more space internally than the <cite>channel_config</cite>
and <cite>sample_type</cite> suggest.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.source_count">
<em class="property">property </em><code class="sig-name descname">source_count</code><a class="headerlink" href="#palace.Buffer.source_count" title="Permalink to this definition"></a></dt>
<dd><p>Number of sources currently using the buffer.</p>
<p>Notes:
<cite>Context.update</cite> needs to be called to reliably ensure the count
is kept updated for when sources reach their end. This is
equivalent to calling <cite>len(self.sources)</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Buffer.sources">
<em class="property">property </em><code class="sig-name descname">sources</code><a class="headerlink" href="#palace.Buffer.sources" title="Permalink to this definition"></a></dt>
<dd><p><cite>Source</cite> objects currently playing the buffer.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.Source">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Source</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source" title="Permalink to this definition"></a></dt>
<dd><p>Sound source for playing audio.</p>
<p>There is no practical limit to the number of sources one may create.</p>
<p>When the source is no longer needed, <cite>destroy</cite> must be called,
unless the context manager is used, which guarantees the sources
destructioni upon completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the source is to be created.</p>
</dd>
</dl>
<dl class="attribute">
<dt id="palace.Source.air_absorption_factor">
<code class="sig-name descname">air_absorption_factor</code><a class="headerlink" href="#palace.Source.air_absorption_factor" title="Permalink to this definition"></a></dt>
<dd><p>Multiplier for the amount of atmospheric high-frequency
absorption, ranging from 0 to 10. A factor of 1 results in
a nominal -0.05 dB per meter, with higher values simulating
foggy air and lower values simulating dryer air; default to 0.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.auxiliary_send">
<em class="property">property </em><code class="sig-name descname">auxiliary_send</code><a class="headerlink" href="#palace.Source.auxiliary_send" title="Permalink to this definition"></a></dt>
<dd><p>Connect the effect slot to the given send path.</p>
<p>Any filter properties on the send path remain as they were.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.cone_angles">
<code class="sig-name descname">cone_angles</code><a class="headerlink" href="#palace.Source.cone_angles" title="Permalink to this definition"></a></dt>
<dd><p>Cone inner and outer angles in degrees.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>inner</strong> (<em>float</em>) The area within which the listener will hear the source
without extra attenuation, default to 360.</p></li>
<li><p><strong>outer</strong> (<em>float</em>) The area outside of which the listener will hear the source
attenuated according to <cite>outer_cone_gains</cite>, default to 360.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <cite>inner</cite> is greater than <cite>outer</cite>
or either of them is outside of the [0, 360] interval.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>The areas follow the facing direction, so for example
an inner angle of 180 means the entire front face of
the source is in the inner cone.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Destroy the source, stop playback and release resources.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.distance_range">
<code class="sig-name descname">distance_range</code><a class="headerlink" href="#palace.Source.distance_range" title="Permalink to this definition"></a></dt>
<dd><p>Reference and maximum distance for current distance model.</p>
<p>For Clamped distance models, the sources calculated
distance is clamped to the specified range before applying
distance-related attenuation.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>refdist</strong> (<em>float</em>) The distance at which the sources volume will not have
any extra attenuation (an effective gain multiplier of 1),
default to 0.</p></li>
<li><p><strong>maxdist</strong> (<em>float</em>) The maximum distance, default to FLT_MAX, which is the
maximum value of a single-precision floating-point variable
(2**128 - 2**104).</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <cite>refdist</cite> is greater than <cite>maxdist</cite>
or either of them is outside of the [0, FLT_MAX] interval.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.doppler_factor">
<code class="sig-name descname">doppler_factor</code><a class="headerlink" href="#palace.Source.doppler_factor" title="Permalink to this definition"></a></dt>
<dd><p>The doppler factor for the doppler effects pitch shift.</p>
<p>This effectively scales the source and listener velocities
for the doppler calculation.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a value outside of the [0, 1] interval.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.Source.fade_out_to_stop">
<code class="sig-name descname">fade_out_to_stop</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">double gain: float</em>, <em class="sig-param">ms: int</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source.fade_out_to_stop" title="Permalink to this definition"></a></dt>
<dd><p>Fade the source to <cite>gain</cite> over <cite>ms</cite> milliseconds.</p>
<p><cite>gain</cite> is in addition to the base gain and must be within
the [0, 1] interval. <cite>ms</cite> must be positive.</p>
<p>The fading is logarithmic. As a result, the initial drop-off
may happen faster than expected but the fading is more
perceptually consistant over the given duration. It will take
just as much time to go from -6 dB to -12 dB as it will to go
from -40 dB to -46 dB, for example.</p>
<p>Pending playback from a future buffer is not immediately
canceled, but the fade timer starts with this call. If the
future buffer then becomes ready, it will start mid-fade.
Pending playback will be canceled if the fade out completes
before the future buffer becomes ready.</p>
<p>Fading is updated during calls to <cite>Context.update</cite>,
which should be called regularly (30 to 50 times per second)
for the fading to be smooth.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.gain">
<code class="sig-name descname">gain</code><a class="headerlink" href="#palace.Source.gain" title="Permalink to this definition"></a></dt>
<dd><p>Base linear volume gain, default to 1.0.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a negative value.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.gain_auto">
<code class="sig-name descname">gain_auto</code><a class="headerlink" href="#palace.Source.gain_auto" title="Permalink to this definition"></a></dt>
<dd><p>Whether the direct paths high frequency gain,
send paths gain and send paths high-frequency gain are
automatically adjusted. The default is <cite>True</cite> for all.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.gain_range">
<code class="sig-name descname">gain_range</code><a class="headerlink" href="#palace.Source.gain_range" title="Permalink to this definition"></a></dt>
<dd><p>The range which the sources gain is clamped to after
distance and cone attenuation are applied to the gain base,
although before the filter gain adjustements.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>mingain</strong> (<em>float</em>) Minimum gain, default to 0.</p></li>
<li><p><strong>maxgain</strong> (<em>float</em>) Maximum gain, default to 1.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <cite>mingain</cite> is greater than <cite>maxgain</cite>
or either of them is outside of the [0, 1] interval.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.group">
<code class="sig-name descname">group</code><a class="headerlink" href="#palace.Source.group" title="Permalink to this definition"></a></dt>
<dd><p>Parent group of this source.</p>
<p>The parent group influences all sources that belong to it.
A source may only be the child of one <cite>SourceGroup</cite> at a time,
although that source group may belong to another source group.</p>
<p>This is <cite>None</cite> when the source does not belong to any group.
On the other hand, setting it to <cite>None</cite> removes the source
from its current group.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.SourceGroup" title="palace.SourceGroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SourceGroup</span></code></a></dt><dd><p>A group of <cite>Source</cite> references</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="method">
<dt id="palace.Source.latency">
<em class="property">property </em><code class="sig-name descname">latency</code><a class="headerlink" href="#palace.Source.latency" title="Permalink to this definition"></a></dt>
<dd><p>Source latency in nanoseconds.</p>
<p>If the <cite>AL_SOFT_source_latency</cite> extension is unsupported,
the latency will be 0.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.latency_seconds">
<em class="property">property </em><code class="sig-name descname">latency_seconds</code><a class="headerlink" href="#palace.Source.latency_seconds" title="Permalink to this definition"></a></dt>
<dd><p>Source latency in seconds.</p>
<p>If the <cite>AL_SOFT_source_latency</cite> extension is unsupported,
the latency will be 0.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.looping">
<code class="sig-name descname">looping</code><a class="headerlink" href="#palace.Source.looping" title="Permalink to this definition"></a></dt>
<dd><p>Whether the source should loop on the Buffer or Decoder
objects loop points.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.offset">
<code class="sig-name descname">offset</code><a class="headerlink" href="#palace.Source.offset" title="Permalink to this definition"></a></dt>
<dd><p>Source offset in sample frames. For streaming sources
this will be the offset based on the decoders read position.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.offset_seconds">
<em class="property">property </em><code class="sig-name descname">offset_seconds</code><a class="headerlink" href="#palace.Source.offset_seconds" title="Permalink to this definition"></a></dt>
<dd><p>Source offset in seconds.</p>
<p>For streaming sources this will be the offset based on
the decoders read position.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.orientation">
<code class="sig-name descname">orientation</code><a class="headerlink" href="#palace.Source.orientation" title="Permalink to this definition"></a></dt>
<dd><p>3D orientation of the source.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>at</strong> (<em>Tuple</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) Relative position.</p></li>
<li><p><strong>up</strong> (<em>Tuple</em><em>[</em><em>float</em><em>, </em><em>float</em><em>, </em><em>float</em><em>]</em>) Relative direction.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Unlike the <cite>AL_EXT_BFORMAT</cite> extension this property
comes from, this also affects the facing direction.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.outer_cone_gains">
<code class="sig-name descname">outer_cone_gains</code><a class="headerlink" href="#palace.Source.outer_cone_gains" title="Permalink to this definition"></a></dt>
<dd><p>Linear gain and gainhf multiplier when the listener is
outside of the sources outer cone area.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>gain</strong> (<em>float</em>) Linear gain applying to all frequencies, default to 1.</p></li>
<li><p><strong>gainhf</strong> (<em>float</em>) Linear gainhf applying extra attenuation to high frequencies
creating a low-pass effect, default to 1. It has no effect
without the <cite>ALC_EXT_EFX</cite> extension.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>ValueError</strong> If either of the gains is set to a value
outside of the [0, 1] interval.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.Source.pause">
<code class="sig-name descname">pause</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source.pause" title="Permalink to this definition"></a></dt>
<dd><p>Pause the source if it is playing.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.paused">
<em class="property">property </em><code class="sig-name descname">paused</code><a class="headerlink" href="#palace.Source.paused" title="Permalink to this definition"></a></dt>
<dd><p>Whether the source is currently paused.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.pending">
<em class="property">property </em><code class="sig-name descname">pending</code><a class="headerlink" href="#palace.Source.pending" title="Permalink to this definition"></a></dt>
<dd><p>Whether the source is waiting to play a future buffer.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.pitch">
<code class="sig-name descname">pitch</code><a class="headerlink" href="#palace.Source.pitch" title="Permalink to this definition"></a></dt>
<dd><p>Linear pitch shift base, default to 1.0.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a nonpositive value.</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.Source.playing">
<em class="property">property </em><code class="sig-name descname">playing</code><a class="headerlink" href="#palace.Source.playing" title="Permalink to this definition"></a></dt>
<dd><p>Whether the source is currently playing.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.playing_or_pending">
<em class="property">property </em><code class="sig-name descname">playing_or_pending</code><a class="headerlink" href="#palace.Source.playing_or_pending" title="Permalink to this definition"></a></dt>
<dd><p>Whether the source is currently playing
or waiting to play in a future buffer.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.position">
<code class="sig-name descname">position</code><a class="headerlink" href="#palace.Source.position" title="Permalink to this definition"></a></dt>
<dd><p>3D position of the source.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.priority">
<code class="sig-name descname">priority</code><a class="headerlink" href="#palace.Source.priority" title="Permalink to this definition"></a></dt>
<dd><p>Playback priority (natural number).</p>
<p>The lowest priority sources will be forcefully stopped
when no more mixing sources are available and higher priority
sources are played.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.radius">
<code class="sig-name descname">radius</code><a class="headerlink" href="#palace.Source.radius" title="Permalink to this definition"></a></dt>
<dd><p>Radius of the source, as if it is a sound-emitting sphere.</p>
<p>This has no effect without the <cite>AL_EXT_SOURCE_RADIUS</cite> extension.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a negative value.</p>
</dd>
</dl>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.relative">
<code class="sig-name descname">relative</code><a class="headerlink" href="#palace.Source.relative" title="Permalink to this definition"></a></dt>
<dd><p>Whether the sources position, velocity, and orientation
are relative to the listener.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.resampler_index">
<code class="sig-name descname">resampler_index</code><a class="headerlink" href="#palace.Source.resampler_index" title="Permalink to this definition"></a></dt>
<dd><p>Index of the resampler to use for this source.</p>
<p>The index must be nonnegative, from the resamplers returned
by <cite>Context.get_available_resamplers</cite>, and has no effect
without the <cite>AL_SOFT_source_resampler</cite> extension.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.resume">
<code class="sig-name descname">resume</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source.resume" title="Permalink to this definition"></a></dt>
<dd><p>Resume the source if it is paused.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.rolloff_factors">
<code class="sig-name descname">rolloff_factors</code><a class="headerlink" href="#palace.Source.rolloff_factors" title="Permalink to this definition"></a></dt>
<dd><p>Rolloff factor and room factor for the direct and send paths.</p>
<p>This is effectively a distance scaling relative to
the reference distance.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If either of rolloff factors is set to a negative value.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>To disable distance attenuation for send paths,
set room factor to 0. The reverb engine will, by default,
apply a more realistic room decay based on the reverb decay
time and distance.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.spatialize">
<code class="sig-name descname">spatialize</code><a class="headerlink" href="#palace.Source.spatialize" title="Permalink to this definition"></a></dt>
<dd><p>Either <cite>True</cite> (the source always has 3D spatialization
features), <cite>False</cite> (never has 3D spatialization features),
or <cite>None</cite> (spatialization is enabled based on playing
a mono sound or not, default).</p>
<p>This has no effect without
the <cite>AL_SOFT_source_spatialize</cite> extension.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.stereo_angles">
<code class="sig-name descname">stereo_angles</code><a class="headerlink" href="#palace.Source.stereo_angles" title="Permalink to this definition"></a></dt>
<dd><p>Left and right channel angles, in radians, when playing
a stereo buffer or stream. The angles go counter-clockwise,
with 0 being in front and positive values going left.</p>
<p>This has no effect without the <cite>AL_EXT_STEREO_ANGLES</cite> extension.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Source.stop">
<code class="sig-name descname">stop</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Source.stop" title="Permalink to this definition"></a></dt>
<dd><p>Stop playback, releasing the buffer or decoder reference.</p>
<p>Any pending playback from a future buffer is canceled.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.Source.velocity">
<code class="sig-name descname">velocity</code><a class="headerlink" href="#palace.Source.velocity" title="Permalink to this definition"></a></dt>
<dd><p>3D velocity in units per second.</p>
<p>As with OpenAL, this does not actually alter the sources
position, and instead just alters the pitch as determined
by the doppler effect.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.SourceGroup">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">SourceGroup</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.SourceGroup" title="Permalink to this definition"></a></dt>
<dd><p>A group of <cite>Source</cite> references.</p>
<p>For instance, setting <cite>SourceGroup.gain</cite> to 0.5 will halve the gain
of all sources in the group.</p>
<p>This can be used as a context manager that calls <cite>destroy</cite> upon
completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the source group is to be created.</p>
</dd>
</dl>
<dl class="method">
<dt id="palace.SourceGroup.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.SourceGroup.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Destroy the source group, remove and free all sources.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.SourceGroup.gain">
<code class="sig-name descname">gain</code><a class="headerlink" href="#palace.SourceGroup.gain" title="Permalink to this definition"></a></dt>
<dd><p>Source group gain.</p>
<p>This accumulates with its sources and sub-groups gain.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.SourceGroup.parent_group">
<code class="sig-name descname">parent_group</code><a class="headerlink" href="#palace.SourceGroup.parent_group" title="Permalink to this definition"></a></dt>
<dd><p>The source group this source group is a child of.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeException</strong> If this group is being added to its sub-group
(i.e. it would create a circular sub-group chain).</p>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.SourceGroup.pause_all">
<code class="sig-name descname">pause_all</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.SourceGroup.pause_all" title="Permalink to this definition"></a></dt>
<dd><p>Pause all currently-playing sources that are under
this group, including sub-groups.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.SourceGroup.pitch">
<code class="sig-name descname">pitch</code><a class="headerlink" href="#palace.SourceGroup.pitch" title="Permalink to this definition"></a></dt>
<dd><p>Source group pitch.</p>
<p>This accumulates with its sources and sub-groups pitch.</p>
</dd></dl>
<dl class="method">
<dt id="palace.SourceGroup.resume_all">
<code class="sig-name descname">resume_all</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.SourceGroup.resume_all" title="Permalink to this definition"></a></dt>
<dd><p>Resume all paused sources that are under this group,
including sub-groups.</p>
</dd></dl>
<dl class="method">
<dt id="palace.SourceGroup.sources">
<em class="property">property </em><code class="sig-name descname">sources</code><a class="headerlink" href="#palace.SourceGroup.sources" title="Permalink to this definition"></a></dt>
<dd><p>Sources under this group.</p>
</dd></dl>
<dl class="method">
<dt id="palace.SourceGroup.stop_all">
<code class="sig-name descname">stop_all</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.SourceGroup.stop_all" title="Permalink to this definition"></a></dt>
<dd><p>Stop all sources that are under this group,
including sub-groups.</p>
</dd></dl>
<dl class="method">
<dt id="palace.SourceGroup.sub_groups">
<em class="property">property </em><code class="sig-name descname">sub_groups</code><a class="headerlink" href="#palace.SourceGroup.sub_groups" title="Permalink to this definition"></a></dt>
<dd><p>Source groups under this group.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.AuxiliaryEffectSlot">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">AuxiliaryEffectSlot</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.AuxiliaryEffectSlot" title="Permalink to this definition"></a></dt>
<dd><p>An effect processor.</p>
<p>It takes the output mix of zero or more sources,
applies DSP for the desired effect (as configured
by a given <cite>Effect</cite> object), then adds to the output mix.</p>
<p>This can be used as a context manager that calls <cite>destroy</cite>
upon completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context to create the auxiliary effect slot.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If the effect slot cant be created.</p>
</dd>
</dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.AuxiliaryEffectSlot.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Destroy the effect slot, returning it to the system.
If the effect slot is currently set on a source send,
it will be removed first.</p>
</dd></dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.effect">
<em class="property">property </em><code class="sig-name descname">effect</code><a class="headerlink" href="#palace.AuxiliaryEffectSlot.effect" title="Permalink to this definition"></a></dt>
<dd><p>Effect to be held by the slot.</p>
<p>The given effect object may be altered or destroyed without
affecting the effect slot.</p>
</dd></dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.gain">
<em class="property">property </em><code class="sig-name descname">gain</code><a class="headerlink" href="#palace.AuxiliaryEffectSlot.gain" title="Permalink to this definition"></a></dt>
<dd><p>Gain of the effect slot.</p>
</dd></dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.send_auto">
<em class="property">property </em><code class="sig-name descname">send_auto</code><a class="headerlink" href="#palace.AuxiliaryEffectSlot.send_auto" title="Permalink to this definition"></a></dt>
<dd><p>If set to <cite>True</cite>, the reverb effect will automatically
apply adjustments to the sources send slot gains based
on the effect properties.</p>
<p>Has no effect when using non-reverb effects. Default is <cite>True</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.source_sends">
<em class="property">property </em><code class="sig-name descname">source_sends</code><a class="headerlink" href="#palace.AuxiliaryEffectSlot.source_sends" title="Permalink to this definition"></a></dt>
<dd><p>List of each <cite>Source</cite> object and its pairing
send this effect slot is set on.</p>
</dd></dl>
<dl class="method">
<dt id="palace.AuxiliaryEffectSlot.use_count">
<em class="property">property </em><code class="sig-name descname">use_count</code><a class="headerlink" href="#palace.AuxiliaryEffectSlot.use_count" title="Permalink to this definition"></a></dt>
<dd><p>Number of source sends the effect slot
is used by. This is equivalent to calling
<cite>len(tuple(self.source_sends))</cite>.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.Effect">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Effect</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Effect" title="Permalink to this definition"></a></dt>
<dd><p>A collection of settings or parameters.</p>
<p>This can be used as a context manager that calls <cite>destroy</cite>
upon completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the effect is to be created.</p>
</dd>
</dl>
<dl class="method">
<dt id="palace.Effect.chorus_properties">
<em class="property">property </em><code class="sig-name descname">chorus_properties</code><a class="headerlink" href="#palace.Effect.chorus_properties" title="Permalink to this definition"></a></dt>
<dd><p>The effect with the specified chorus properties.</p>
<p>It will be thrown if EAXReverb effect is not supported.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Effect.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><em class="sig-param">self</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Effect.destroy" title="Permalink to this definition"></a></dt>
<dd><p>Destroy the effect.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Effect.reverb_properties">
<em class="property">property </em><code class="sig-name descname">reverb_properties</code><a class="headerlink" href="#palace.Effect.reverb_properties" title="Permalink to this definition"></a></dt>
<dd><p>The effect with the specified reverb properties.</p>
<p>It will automatically downgrade to the Standard Reverb effect
if EAXReverb effect is not supported.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.Decoder">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Decoder</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em>, <em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Decoder" title="Permalink to this definition"></a></dt>
<dd><p>Generic audio decoder.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>context</strong> (<a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a>) The context from which the decoder is to be created.</p></li>
<li><p><strong>name</strong> (<em>str</em>) Audio file or resource name.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If decoder creation fails.</p>
</dd>
</dl>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.Buffer" title="palace.Buffer"><code class="xref py py-class docutils literal notranslate"><span class="pre">Buffer</span></code></a></dt><dd><p>Preloaded PCM samples coming from a <cite>Decoder</cite></p>
</dd>
</dl>
</div>
<p class="rubric">Notes</p>
<p>Due to implementation details, while this creates decoder objects
from filenames using contexts, it is the superclass of the ABC
(abstract base class) <cite>BaseDecoder</cite>. Because of this, <cite>Decoder</cite>
may only initialize an internal one. To use registered factories,
please call the <cite>smart</cite> static method instead.</p>
<dl class="method">
<dt id="palace.Decoder.channel_config">
<em class="property">property </em><code class="sig-name descname">channel_config</code><a class="headerlink" href="#palace.Decoder.channel_config" title="Permalink to this definition"></a></dt>
<dd><p>Channel configuration of the audio being decoded.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.frequency">
<em class="property">property </em><code class="sig-name descname">frequency</code><a class="headerlink" href="#palace.Decoder.frequency" title="Permalink to this definition"></a></dt>
<dd><p>Sample frequency, in hertz, of the audio being decoded.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.length">
<em class="property">property </em><code class="sig-name descname">length</code><a class="headerlink" href="#palace.Decoder.length" title="Permalink to this definition"></a></dt>
<dd><p>Length of audio in sample frames, falling-back to 0.</p>
<p class="rubric">Notes</p>
<p>Zero-length decoders may not be used to load a <cite>Buffer</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.length_seconds">
<em class="property">property </em><code class="sig-name descname">length_seconds</code><a class="headerlink" href="#palace.Decoder.length_seconds" title="Permalink to this definition"></a></dt>
<dd><p>Length of audio in seconds, falling-back to 0.0.</p>
<p class="rubric">Notes</p>
<p>Zero-length decoders may not be used to load a <cite>Buffer</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.loop_points">
<em class="property">property </em><code class="sig-name descname">loop_points</code><a class="headerlink" href="#palace.Decoder.loop_points" title="Permalink to this definition"></a></dt>
<dd><p>Loop points in sample frames.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>start</strong> (<em>int</em>) Inclusive starting loop point.</p></li>
<li><p><strong>end</strong> (<em>int</em>) Exclusive starting loop point.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If <cite>start &gt;= end</cite>, all available samples are included
in the loop.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.play">
<code class="sig-name descname">play</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Source source: Source</em>, <em class="sig-param">chunk_len: int</em>, <em class="sig-param">queue_size: int</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.Decoder.play" title="Permalink to this definition"></a></dt>
<dd><p>Stream audio asynchronously from the decoder.</p>
<p>The decoder must NOT have its <cite>read</cite> or <cite>seek</cite> called
from elsewhere while in use.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>source</strong> (<a class="reference internal" href="#palace.Source" title="palace.Source"><em>Source</em></a>) The source object to play audio.</p></li>
<li><p><strong>chunk_len</strong> (<em>int</em>) The number of sample frames to read for each chunk update.
Smaller values will require more frequent updates and
larger values will handle more data with each chunk.</p></li>
<li><p><strong>queue_size</strong> (<em>int</em>) The number of chunks to keep queued during playback.
Smaller values use less memory while larger values
improve protection against underruns.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.read">
<code class="sig-name descname">read</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">count: int</em><span class="sig-paren">)</span> &#x2192; bytes<a class="headerlink" href="#palace.Decoder.read" title="Permalink to this definition"></a></dt>
<dd><p>Decode and return <cite>count</cite> sample frames.</p>
<p>If less than the requested count samples is returned,
the end of the audio has been reached.</p>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="#palace.sample_length" title="palace.sample_length"><code class="xref py py-meth docutils literal notranslate"><span class="pre">sample_length()</span></code></a></dt><dd><p>length of samples of given size</p>
</dd>
</dl>
</div>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.sample_type">
<em class="property">property </em><code class="sig-name descname">sample_type</code><a class="headerlink" href="#palace.Decoder.sample_type" title="Permalink to this definition"></a></dt>
<dd><p>Sample type of the audio being decoded.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.seek">
<code class="sig-name descname">seek</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">pos: int</em><span class="sig-paren">)</span> &#x2192; bool<a class="headerlink" href="#palace.Decoder.seek" title="Permalink to this definition"></a></dt>
<dd><p>Seek to pos, specified in sample frames.</p>
<p>Return if the seek was successful.</p>
</dd></dl>
<dl class="method">
<dt id="palace.Decoder.smart">
<em class="property">static </em><code class="sig-name descname">smart</code><span class="sig-paren">(</span><em class="sig-param">Context context: Context</em>, <em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; Decoder<a class="headerlink" href="#palace.Decoder.smart" title="Permalink to this definition"></a></dt>
<dd><p>Return the decoder created from the given resource name.</p>
<p>This first tries user-registered decoder factories in
lexicographical order, then fallback to the internal ones.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.BaseDecoder">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">BaseDecoder</code><a class="headerlink" href="#palace.BaseDecoder" title="Permalink to this definition"></a></dt>
<dd><p>Audio decoder interface.</p>
<p>Applications may derive from this, implement necessary methods,
and use it in places the API wants a <cite>BaseDecoder</cite> object.</p>
<p>Exceptions raised from <cite>BaseDecoder</cite> instances are ignored.</p>
<dl class="method">
<dt id="palace.BaseDecoder.channel_config">
<em class="property">abstract property </em><code class="sig-name descname">channel_config</code><a class="headerlink" href="#palace.BaseDecoder.channel_config" title="Permalink to this definition"></a></dt>
<dd><p>Channel configuration of the audio being decoded.</p>
</dd></dl>
<dl class="method">
<dt id="palace.BaseDecoder.frequency">
<em class="property">abstract property </em><code class="sig-name descname">frequency</code><a class="headerlink" href="#palace.BaseDecoder.frequency" title="Permalink to this definition"></a></dt>
<dd><p>Sample frequency, in hertz, of the audio being decoded.</p>
</dd></dl>
<dl class="method">
<dt id="palace.BaseDecoder.length">
<em class="property">abstract property </em><code class="sig-name descname">length</code><a class="headerlink" href="#palace.BaseDecoder.length" title="Permalink to this definition"></a></dt>
<dd><p>Length of audio in sample frames, falling-back to 0.</p>
<p class="rubric">Notes</p>
<p>Zero-length decoders may not be used to load a <cite>Buffer</cite>.</p>
</dd></dl>
<dl class="method">
<dt id="palace.BaseDecoder.loop_points">
<em class="property">abstract property </em><code class="sig-name descname">loop_points</code><a class="headerlink" href="#palace.BaseDecoder.loop_points" title="Permalink to this definition"></a></dt>
<dd><p>Loop points in sample frames.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>start</strong> (<em>int</em>) Inclusive starting loop point.</p></li>
<li><p><strong>end</strong> (<em>int</em>) Exclusive starting loop point.</p></li>
</ul>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If <cite>start &gt;= end</cite>, all available samples are included
in the loop.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.BaseDecoder.read">
<code class="sig-name descname">read</code><a class="headerlink" href="#palace.BaseDecoder.read" title="Permalink to this definition"></a></dt>
<dd><p>Decode and return <cite>count</cite> sample frames.</p>
<p>If less than the requested count samples is returned,
the end of the audio has been reached.</p>
</dd></dl>
<dl class="method">
<dt id="palace.BaseDecoder.sample_type">
<em class="property">abstract property </em><code class="sig-name descname">sample_type</code><a class="headerlink" href="#palace.BaseDecoder.sample_type" title="Permalink to this definition"></a></dt>
<dd><p>Sample type of the audio being decoded.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.BaseDecoder.seek">
<code class="sig-name descname">seek</code><a class="headerlink" href="#palace.BaseDecoder.seek" title="Permalink to this definition"></a></dt>
<dd><p>Seek to pos, specified in sample frames.</p>
<p>Return if the seek was successful.</p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.FileIO">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">FileIO</code><a class="headerlink" href="#palace.FileIO" title="Permalink to this definition"></a></dt>
<dd><p>File I/O protocol.</p>
<p>This static duck type defines methods required to be used by
palace decoders. Despite its name, a <cite>FileIO</cite> is not necessarily
created from a file, but any seekable finite input stream.</p>
<p>Many classes defined in the standard library module <cite>io</cite>
are compatible with this protocol.</p>
<p class="rubric">Notes</p>
<p>Since PEP 544 is only implemented in Python 3.8+, type checking
for this on earlier Python version might not work as expected.</p>
<dl class="attribute">
<dt id="palace.FileIO.close">
<code class="sig-name descname">close</code><a class="headerlink" href="#palace.FileIO.close" title="Permalink to this definition"></a></dt>
<dd><p>Close the file.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.FileIO.read">
<code class="sig-name descname">read</code><a class="headerlink" href="#palace.FileIO.read" title="Permalink to this definition"></a></dt>
<dd><p>Read at most size bytes, returned as bytes.</p>
</dd></dl>
<dl class="attribute">
<dt id="palace.FileIO.seek">
<code class="sig-name descname">seek</code><a class="headerlink" href="#palace.FileIO.seek" title="Permalink to this definition"></a></dt>
<dd><p>Move to new file position and return the file position.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>offset</strong> (<em>int</em>) A byte count.</p></li>
<li><p><strong>whence</strong> (<em>int</em><em>, </em><em>optional</em>) Either 0 (default, move relative to start of file),
1 (move relative to current position)
or 2 (move relative to end of file).</p></li>
</ul>
</dd>
</dl>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="palace.MessageHandler">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">MessageHandler</code><a class="headerlink" href="#palace.MessageHandler" title="Permalink to this definition"></a></dt>
<dd><p>Message handler interface.</p>
<p>Applications may derive from this and set an instance on a context
to receive messages. The base methods are no-ops, so subclasses
only need to implement methods for relevant messages.</p>
<p>Exceptions raised from <cite>MessageHandler</cite> instances are ignored.</p>
<dl class="method">
<dt id="palace.MessageHandler.buffer_loading">
<code class="sig-name descname">buffer_loading</code><span class="sig-paren">(</span><em class="sig-param">self, str name: str, str channel_config: str, str sample_type: str, sample_rate: int, data: List[int]</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.MessageHandler.buffer_loading" title="Permalink to this definition"></a></dt>
<dd><p>Handle messages from Buffer initialization.</p>
<p>This is called when a new buffer is about to be created
and loaded. which may be called asynchronously for buffers
being loaded asynchronously.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) Resource name passed to <cite>Buffer</cite>.</p></li>
<li><p><strong>channel_config</strong> (<em>str</em>) Channel configuration of the given audio data.</p></li>
<li><p><strong>sample_type</strong> (<em>str</em>) Sample type of the given audio data.</p></li>
<li><p><strong>sample_rate</strong> (<em>int</em>) Sample rate of the given audio data.</p></li>
<li><p><strong>data</strong> (<em>List</em><em>[</em><em>int</em><em>]</em>) The audio data that is about to be fed to the OpenAL buffer.</p></li>
</ul>
</dd>
</dl>
</dd></dl>
<dl class="method">
<dt id="palace.MessageHandler.device_disconnected">
<code class="sig-name descname">device_disconnected</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Device device: Device</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.MessageHandler.device_disconnected" title="Permalink to this definition"></a></dt>
<dd><p>Handle disconnected device messages.</p>
<p>This is called when the given device has been disconnected and
is no longer usable for output. As per the <cite>ALC_EXT_disconnect</cite>
specification, disconnected devices remain valid, however all
playing sources are automatically stopped, any sources that are
attempted to play will immediately stop, and new contexts may
not be created on the device.</p>
<p class="rubric">Notes</p>
<p>Connection status is checked during <cite>Context.update</cite> calls, so
method must be called regularly to be notified when a device is
disconnected. This method may not be called if the device lacks
support for the <cite>ALC_EXT_disconnect</cite> extension.</p>
</dd></dl>
<dl class="method">
<dt id="palace.MessageHandler.resource_not_found">
<code class="sig-name descname">resource_not_found</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">str name: str</em><span class="sig-paren">)</span> &#x2192; str<a class="headerlink" href="#palace.MessageHandler.resource_not_found" title="Permalink to this definition"></a></dt>
<dd><p>Return the fallback resource for the one of the given name.</p>
<p>This is called when <cite>name</cite> is not found, allowing substitution
of a different resource until the returned string either points
to a valid resource or is empty (default).</p>
<p>For buffers being cached, the original name will still be used
for the cache entry so one does not have to keep track of
substituted resource names.</p>
</dd></dl>
<dl class="method">
<dt id="palace.MessageHandler.source_force_stopped">
<code class="sig-name descname">source_force_stopped</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Source source: Source</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.MessageHandler.source_force_stopped" title="Permalink to this definition"></a></dt>
<dd><p>Handle forcefully stopped sources.</p>
<p>This is called when the given source was forced to stop,
because of one of the following reasons:</p>
<ul class="simple">
<li><p>There were no more mixing sources and a higher-priority source
preempted it.</p></li>
<li><p><cite>source</cite> is part of a <cite>SourceGroup</cite> (or sub-group thereof)
that had its <cite>SourceGroup.stop_all</cite> method called.</p></li>
<li><p><cite>source</cite> was playing a buffer thats getting removed.</p></li>
</ul>
</dd></dl>
<dl class="method">
<dt id="palace.MessageHandler.source_stopped">
<code class="sig-name descname">source_stopped</code><span class="sig-paren">(</span><em class="sig-param">self</em>, <em class="sig-param">Source source: Source</em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.MessageHandler.source_stopped" title="Permalink to this definition"></a></dt>
<dd><p>Handle end-of-buffer/stream messages.</p>
<p>This is called when the given source reaches the end of buffer
or stream, which is detected upon a call to <cite>Context.update</cite>.</p>
</dd></dl>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
<div class="sphinxsidebarwrapper">
<h1 class="logo"><a href="index.html">palace</a></h1>
<h3>Navigation</h3>
<p class="caption"><span class="caption-text">Contents:</span></p>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="installation.html">Installation</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Reference</a><ul class="simple">
</ul>
</li>
</ul>
<div class="relations">
<h3>Related Topics</h3>
<ul>
<li><a href="index.html">Documentation overview</a><ul>
<li>Previous: <a href="installation.html" title="previous chapter">Installation</a></li>
</ul></li>
</ul>
</div>
<div id="searchbox" style="display: none" role="search">
<h3 id="searchlabel">Quick search</h3>
<div class="searchformwrapper">
<form class="search" action="search.html" method="get">
<input type="text" name="q" aria-labelledby="searchlabel" />
<input type="submit" value="Go" />
</form>
</div>
</div>
<script>$('#searchbox').show(0);</script>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="footer">
&copy;2019, 2020 Nguyễn Gia Phong et al.
|
Powered by <a href="http://sphinx-doc.org/">Sphinx 2.4.3</a>
&amp; <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
<a href="_sources/reference.rst.txt"
rel="nofollow">Page source</a>
</div>
</body>
</html>