Build at 2020-09-09T10:41:12+00:00

This commit is contained in:
Nguyễn Gia Phong 2020-09-09 10:41:12 +00:00
parent b8c2db1f5a
commit a4fa0c918c
8 changed files with 125 additions and 125 deletions

View File

@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 15f696dd8f7d3d70ce592a5e4a09ce3d
config: f0bd540ce3009d000622d0bef4101383
tags: 645f666f9bcd5a90fca523b33c5a78b7

View File

@ -117,10 +117,10 @@
<dl class="py class">
<dt id="palace.Buffer">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Buffer</code><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,
<dd><p>Buffer of preloaded PCM samples coming from a <a class="reference internal" href="decoder.html#palace.Decoder" title="palace.Decoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Decoder</span></code></a>.</p>
<p>Cached buffers must be freed using <a class="reference internal" href="#palace.Buffer.destroy" title="palace.Buffer.destroy"><code class="xref py py-obj docutils literal notranslate"><span class="pre">destroy</span></code></a> before destroying
<code class="xref py py-obj docutils literal notranslate"><span class="pre">context</span></code>. Alternatively, this can be used as a context manager
that calls <a class="reference internal" href="#palace.Buffer.destroy" title="palace.Buffer.destroy"><code class="xref py py-obj docutils literal notranslate"><span class="pre">destroy</span></code></a> upon completion of the block,
even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -128,7 +128,7 @@ even if an error occurs.</p>
<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>
<li><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the buffer is to be created and cached.
By default <cite>current_context()</cite> is used.</p></li>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p></li>
</ul>
</dd>
</dl>
@ -158,7 +158,7 @@ By default <cite>current_context()</cite> is used.</p></li>
<dt id="palace.Buffer.destroy">
<code class="sig-name descname">destroy</code><span class="sig-paren">(</span><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>
<p>This invalidates all other <a class="reference internal" href="#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a> objects with the same name.</p>
</dd></dl>
<dl class="py method">
@ -178,12 +178,12 @@ By default <cite>current_context()</cite> is used.</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>
<li><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the buffer is to be created.
By default <cite>current_context()</cite> is used.</p></li>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If there is neither any context specified nor current;
or if <cite>name</cite> is already used for another buffer.</p>
or if <a class="reference internal" href="#palace.Buffer.name" title="palace.Buffer.name"><code class="xref py py-obj docutils literal notranslate"><span class="pre">name</span></code></a> is already used for another buffer.</p>
</dd>
</dl>
</dd></dl>
@ -204,9 +204,9 @@ By default <cite>current_context()</cite> is used.</p></li>
<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 <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>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_loop_points</span></code> extension is not supported by the
current context, <code class="xref py py-obj docutils literal notranslate"><span class="pre">start</span> <span class="pre">=</span> <span class="pre">0</span></code> and <code class="xref py py-obj docutils literal notranslate"><span class="pre">end</span> <span class="pre">=</span> <span class="pre">length</span></code> respectively.
Otherwise, <code class="xref py py-obj docutils literal notranslate"><span class="pre">start</span> <span class="pre">&lt;</span> <span class="pre">end</span> <span class="pre">&lt;=</span> <span class="pre">length</span></code>.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><ul class="simple">
@ -223,8 +223,8 @@ Otherwise, <cite>start &lt; end &lt;= length</cite>.</p>
<dl class="py method">
<dt id="palace.Buffer.play">
<code class="sig-name descname">play</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">source</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span><a class="reference internal" href="source.html#palace.Source" title="palace.Source">palace.Source</a><span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; <a class="reference internal" href="source.html#palace.Source" title="palace.Source">palace.Source</a><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,
<dd><p>Play <code class="xref py py-obj docutils literal notranslate"><span class="pre">source</span></code> using the buffer.</p>
<p>Return the source used for playing. If <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code> is given,
create a new one.</p>
<p>One buffer may be played from multiple sources simultaneously.</p>
</dd></dl>
@ -241,8 +241,8 @@ create a new one.</p>
<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>
as it may take more space internally than the <a class="reference internal" href="#palace.Buffer.channel_config" title="palace.Buffer.channel_config"><code class="xref py py-obj docutils literal notranslate"><span class="pre">channel_config</span></code></a>
and <a class="reference internal" href="#palace.Buffer.sample_type" title="palace.Buffer.sample_type"><code class="xref py py-obj docutils literal notranslate"><span class="pre">sample_type</span></code></a> suggest.</p>
</dd></dl>
<dl class="py method">
@ -250,15 +250,15 @@ and <cite>sample_type</cite> suggest.</p>
<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 class="rubric">Notes</p>
<p><cite>Context.update</cite> needs to be called to reliably ensure the count
<p><a class="reference internal" href="context.html#palace.Context.update" title="palace.Context.update"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.update</span></code></a> 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>
equivalent to calling <code class="xref py py-obj docutils literal notranslate"><span class="pre">len(self.sources)</span></code>.</p>
</dd></dl>
<dl class="py 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><p><a class="reference internal" href="source.html#palace.Source" title="palace.Source"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Source</span></code></a> objects currently playing the buffer.</p>
</dd></dl>
</dd></dl>
@ -274,11 +274,11 @@ equivalent to calling <cite>len(self.sources)</cite>.</p>
Cached buffers must be freed before destroying the context.</p>
<p>The resources will be scheduled for caching asynchronously,
and should be retrieved later when needed by initializing
<cite>Buffer</cite> corresponding objects. Resources that cannot be
<a class="reference internal" href="#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a> corresponding objects. Resources that cannot be
loaded, for example due to an unsupported format, will be
ignored and a later <cite>Buffer</cite> initialization will raise
ignored and a later <a class="reference internal" href="#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a> initialization will raise
an exception.</p>
<p>If <cite>context</cite> is not given, <cite>current_context()</cite> will be used.</p>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">context</span></code> is not given, <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> will be used.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>
@ -299,7 +299,7 @@ an exception.</p>
<dt id="palace.free">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">free</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">names</span><span class="p">:</span> <span class="n">Iterable<span class="p">[</span>str<span class="p">]</span></span></em>, <em class="sig-param"><span class="n">context</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span><a class="reference internal" href="context.html#palace.Context" title="palace.Context">palace.Context</a><span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.free" title="Permalink to this definition"></a></dt>
<dd><p>Free cached audio resources given their names.</p>
<p>If <cite>context</cite> is not given, <cite>current_context()</cite> will be used.</p>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">context</span></code> is not given, <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> will be used.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>

View File

@ -138,7 +138,7 @@ such as sources, buffers and effects.</p>
<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="device.html#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>device</strong> (<a class="reference internal" href="device.html#palace.Device" title="palace.Device"><em>Device</em></a>) The <a class="reference internal" href="#palace.Context.device" title="palace.Context.device"><code class="xref py py-obj docutils literal notranslate"><span class="pre">device</span></code></a> 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>
@ -180,7 +180,7 @@ such as sources, buffers and effects.</p>
<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 <cite>AL_SOFT_source_resampler</cite> extension is unsupported,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_resampler</span></code> extension is unsupported,
this will be an empty list. Otherwise there would be
at least one entry.</p>
<p>This method require the context to be current.</p>
@ -190,7 +190,7 @@ at least one entry.</p>
<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 <cite>AL_SOFT_source_resampler</cite> extension is unsupported,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_resampler</span></code> extension is unsupported,
this will return 0.</p>
<p>If you try to access the resampler list with this index
without extension, undefined behavior will occur
@ -218,7 +218,7 @@ closer than its reference distance or farther than its max
distance.</p>
<dl class="field-list simple">
<dt class="field-odd">Raises</dt>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a preset cannot be found in <cite>distance_models</cite>.</p>
<dd class="field-odd"><p><strong>ValueError</strong> If set to a preset cannot be found in <a class="reference internal" href="#palace.distance_models" title="palace.distance_models"><code class="xref py py-obj docutils literal notranslate"><span class="pre">distance_models</span></code></a>.</p>
</dd>
</dl>
</dd></dl>
@ -265,7 +265,7 @@ distance.</p>
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
different unit scale, <a class="reference internal" href="#palace.Listener.meters_per_unit" title="palace.Listener.meters_per_unit"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Listener.meters_per_unit</span></code></a> should
also be adjusted.</p>
</dd></dl>
@ -288,12 +288,12 @@ also be adjusted.</p>
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Listener</code><a class="headerlink" href="#palace.Listener" title="Permalink to this definition"></a></dt>
<dd><p>Listener instance of the given context.</p>
<p>It is recommended that applications access the listener via
<cite>Context.listener</cite>, which avoid the overhead caused by the
<a class="reference internal" href="#palace.Context.listener" title="palace.Context.listener"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.listener</span></code></a>, which avoid the overhead caused by the
creation of the wrapper object.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
<dd class="field-odd"><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context on which the listener instance is to be created.
By default <cite>current_context()</cite> is used.</p>
By default <a class="reference internal" href="#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>
@ -312,7 +312,7 @@ By default <cite>current_context()</cite> is used.</p>
<p>This is used for various effects relying on the distance
in meters including air absorption and initial reverb decay.
If this is changed, so should the speed of sound
(e.g. <cite>context.speed_of_sound = 343.3 / meters_per_unit</cite>
(e.g. <code class="xref py py-obj docutils literal notranslate"><span class="pre">context.speed_of_sound</span> <span class="pre">=</span> <span class="pre">343.3</span> <span class="pre">/</span> <span class="pre">meters_per_unit</span></code>
to maintain a realistic 343.3 m/s for sound propagation).</p>
</dd></dl>
@ -354,7 +354,7 @@ the doppler effect.</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>
<p>Exceptions raised from <a class="reference internal" href="#palace.MessageHandler" title="palace.MessageHandler"><code class="xref py py-obj docutils literal notranslate"><span class="pre">MessageHandler</span></code></a> instances are ignored.</p>
<dl class="py method">
<dt id="palace.MessageHandler.buffer_loading">
<code class="sig-name descname">buffer_loading</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">name</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">channel_config</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">sample_type</span><span class="p">:</span> <span class="n">str</span></em>, <em class="sig-param"><span class="n">sample_rate</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">data</span><span class="p">:</span> <span class="n">Sequence<span class="p">[</span>int<span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; None<a class="headerlink" href="#palace.MessageHandler.buffer_loading" title="Permalink to this definition"></a></dt>
@ -365,7 +365,7 @@ 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>name</strong> (<em>str</em>) Resource name passed to <a class="reference internal" href="buffer.html#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a>.</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>
@ -383,23 +383,23 @@ following Python buffer protocol.</p>
<code class="sig-name descname">device_disconnected</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">device</span><span class="p">:</span> <span class="n"><a class="reference internal" href="device.html#palace.Device" title="palace.Device">palace.Device</a></span></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 <cite>ALC_EXT_disconnect</cite>
is no longer usable for output. As per <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_disconnect</span></code>
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
<p>Connection status is checked during <a class="reference internal" href="#palace.Context.update" title="palace.Context.update"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.update</span></code></a> 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 <cite>ALC_EXT_disconnect</cite> extension.</p>
support for <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_disconnect</span></code> extension.</p>
</dd></dl>
<dl class="py 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"><span class="n">name</span><span class="p">:</span> <span class="n">str</span></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
<p>This is called when <code class="xref py py-obj docutils literal notranslate"><span class="pre">name</span></code> 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
@ -416,9 +416,9 @@ 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>
<li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">source</span></code> is part of a <a class="reference internal" href="source.html#palace.SourceGroup" title="palace.SourceGroup"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SourceGroup</span></code></a> (or sub-group thereof)
that had its <a class="reference internal" href="source.html#palace.SourceGroup.stop_all" title="palace.SourceGroup.stop_all"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SourceGroup.stop_all</span></code></a> method called.</p></li>
<li><p><code class="xref py py-obj docutils literal notranslate"><span class="pre">source</span></code> was playing a buffer thats getting removed.</p></li>
</ul>
</dd></dl>
@ -427,7 +427,7 @@ that had its <cite>SourceGroup.stop_all</cite> method called.</p></li>
<code class="sig-name descname">source_stopped</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">source</span><span class="p">:</span> <span class="n"><a class="reference internal" href="source.html#palace.Source" title="palace.Source">palace.Source</a></span></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>
or stream, which is detected upon a call to <a class="reference internal" href="#palace.Context.update" title="palace.Context.update"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.update</span></code></a>.</p>
</dd></dl>
</dd></dl>
@ -440,33 +440,33 @@ or stream, which is detected upon a call to <cite>Context.update</cite>.</p>
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">use_context</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">context</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span><a class="reference internal" href="#palace.Context" title="palace.Context">palace.Context</a><span class="p">]</span></span></em>, <em class="sig-param"><span class="n">thread</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>bool<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></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>This fails silently if the given context has been destroyed.
In case <cite>thread</cite> is not specified, fallback to preference made by
<cite>thread_local</cite>.</p>
<p>If <cite>thread</cite> is <cite>True</cite>, make the context current
In case <code class="xref py py-obj docutils literal notranslate"><span class="pre">thread</span></code> is not specified, fallback to preference made by
<a class="reference internal" href="#palace.thread_local" title="palace.thread_local"><code class="xref py py-obj docutils literal notranslate"><span class="pre">thread_local</span></code></a>.</p>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">thread</span></code> is <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code>, make the context current
for OpenAL operations on the calling thread only.
This requires the non-device-specific as well as the contexts
device <cite>ALC_EXT_thread_local_context</cite> extension to be available.</p>
device <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_thread_local_context</span></code> extension to be available.</p>
</dd></dl>
<dl class="py 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"><span class="n">thread</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>bool<span class="p">]</span></span> <span class="o">=</span> <span class="default_value">None</span></em><span class="sig-paren">)</span> &#x2192; Optional<span class="p">[</span><a class="reference internal" href="#palace.Context" title="palace.Context">palace.Context</a><span class="p">]</span><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
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">thread</span></code> is set to <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code>, 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>
as well as the contexts device <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_thread_local_context</span></code>
extension to be available.</p>
<p>In case <cite>thread</cite> is not specified, fallback to preference made by
<cite>thread_local</cite>.</p>
<p>In case <code class="xref py py-obj docutils literal notranslate"><span class="pre">thread</span></code> is not specified, fallback to preference made by
<a class="reference internal" href="#palace.thread_local" title="palace.thread_local"><code class="xref py py-obj docutils literal notranslate"><span class="pre">thread_local</span></code></a>.</p>
</dd></dl>
<dl class="py function">
<dt id="palace.thread_local">
<code class="sig-prename descclassname">palace.</code><code class="sig-name descname">thread_local</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">state</span><span class="p">:</span> <span class="n">bool</span></em><span class="sig-paren">)</span> &#x2192; Iterator<span class="p">[</span>None<span class="p">]</span><a class="headerlink" href="#palace.thread_local" title="Permalink to this definition"></a></dt>
<dd><p>Return a context manager controlling preference of local thread.</p>
<p>Effectively, it sets fallback value for <cite>thread</cite> argument
for <cite>current_context</cite> and <cite>use_context</cite>.</p>
<p>Initially, globally current <cite>Context</cite> is preferred.</p>
<p>Effectively, it sets fallback value for <code class="xref py py-obj docutils literal notranslate"><span class="pre">thread</span></code> argument
for <a class="reference internal" href="#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context</span></code></a> and <a class="reference internal" href="#palace.use_context" title="palace.use_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">use_context</span></code></a>.</p>
<p>Initially, globally current <a class="reference internal" href="#palace.Context" title="palace.Context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context</span></code></a> is preferred.</p>
</dd></dl>
</div>

View File

@ -123,7 +123,7 @@
<dd class="field-odd"><ul class="simple">
<li><p><strong>name</strong> (<em>str</em>) Audio file or resource name.</p></li>
<li><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the decoder is to be created.
By default <cite>current_context()</cite> is used.</p></li>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
@ -133,16 +133,16 @@ By default <cite>current_context()</cite> is used.</p></li>
<div class="admonition seealso">
<p class="admonition-title">See also</p>
<dl class="simple">
<dt><a class="reference internal" href="buffer.html#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>
<dt><a class="reference internal" href="buffer.html#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 <a class="reference internal" href="#palace.Decoder" title="palace.Decoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Decoder</span></code></a></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>
(abstract base class) <a class="reference internal" href="#palace.BaseDecoder" title="palace.BaseDecoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BaseDecoder</span></code></a>. Because of this, <a class="reference internal" href="#palace.Decoder" title="palace.Decoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Decoder</span></code></a>
may only initialize an internal one. To use registered factories,
please call the module-level <cite>decode</cite> function instead.</p>
please call the module-level <a class="reference internal" href="#palace.decode" title="palace.decode"><code class="xref py py-obj docutils literal notranslate"><span class="pre">decode</span></code></a> function instead.</p>
<dl class="py 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>
@ -160,7 +160,7 @@ please call the module-level <cite>decode</cite> function instead.</p>
<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>
<p>Zero-length decoders may not be used to load a <a class="reference internal" href="buffer.html#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a>.</p>
</dd></dl>
<dl class="py method">
@ -168,7 +168,7 @@ please call the module-level <cite>decode</cite> function instead.</p>
<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>
<p>Zero-length decoders may not be used to load a <a class="reference internal" href="buffer.html#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a>.</p>
</dd></dl>
<dl class="py method">
@ -185,7 +185,7 @@ please call the module-level <cite>decode</cite> function instead.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If <cite>start &gt;= end</cite>, all available samples are included
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">start</span> <span class="pre">&gt;=</span> <span class="pre">end</span></code>, all available samples are included
in the loop.</p>
</dd></dl>
@ -193,7 +193,7 @@ in the loop.</p>
<dt id="palace.Decoder.play">
<code class="sig-name descname">play</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">chunk_len</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">queue_size</span><span class="p">:</span> <span class="n">int</span></em>, <em class="sig-param"><span class="n">source</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span><a class="reference internal" href="source.html#palace.Source" title="palace.Source">palace.Source</a><span class="p">]</span></span></em><span class="sig-paren">)</span> &#x2192; <a class="reference internal" href="source.html#palace.Source" title="palace.Source">palace.Source</a><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
<p>The decoder must NOT have its <a class="reference internal" href="#palace.Decoder.read" title="palace.Decoder.read"><code class="xref py py-obj docutils literal notranslate"><span class="pre">read</span></code></a> or <a class="reference internal" href="#palace.Decoder.seek" title="palace.Decoder.seek"><code class="xref py py-obj docutils literal notranslate"><span class="pre">seek</span></code></a> called
from elsewhere while in use.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -204,7 +204,7 @@ 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>
<li><p><strong>source</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="source.html#palace.Source" title="palace.Source"><em>Source</em></a><em>]</em><em>, </em><em>optional</em>) The source object to play audio. If <cite>None</cite> is given,
<li><p><strong>source</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="source.html#palace.Source" title="palace.Source"><em>Source</em></a><em>]</em><em>, </em><em>optional</em>) The source object to play audio. If <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code> is given,
a new one will be created from the current context.</p></li>
</ul>
</dd>
@ -220,7 +220,7 @@ a new one will be created from the current context.</p></li>
<dl class="py method">
<dt id="palace.Decoder.read">
<code class="sig-name descname">read</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">count</span><span class="p">:</span> <span class="n">int</span></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>
<dd><p>Decode and return <code class="xref py py-obj docutils literal notranslate"><span class="pre">count</span></code> 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">
@ -241,7 +241,7 @@ the end of the audio has been reached.</p>
<dl class="py method">
<dt id="palace.Decoder.seek">
<code class="sig-name descname">seek</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">pos</span><span class="p">:</span> <span class="n">int</span></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 <cite>pos</cite>, specified in sample frames.</p>
<dd><p>Seek to <code class="xref py py-obj docutils literal notranslate"><span class="pre">pos</span></code>, specified in sample frames.</p>
<p>Return if the seek was successful.</p>
</dd></dl>
@ -284,8 +284,8 @@ lexicographical order, then fallback to the internal ones.</p>
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">BaseDecoder</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><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>
and use it in places the API wants a <a class="reference internal" href="#palace.BaseDecoder" title="palace.BaseDecoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BaseDecoder</span></code></a> object.</p>
<p>Exceptions raised from <a class="reference internal" href="#palace.BaseDecoder" title="palace.BaseDecoder"><code class="xref py py-obj docutils literal notranslate"><span class="pre">BaseDecoder</span></code></a> instances are ignored.</p>
<dl class="py 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>
@ -303,7 +303,7 @@ and use it in places the API wants a <cite>BaseDecoder</cite> object.</p>
<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>
<p>Zero-length decoders may not be used to load a <a class="reference internal" href="buffer.html#palace.Buffer" title="palace.Buffer"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Buffer</span></code></a>.</p>
</dd></dl>
<dl class="py method">
@ -320,14 +320,14 @@ and use it in places the API wants a <cite>BaseDecoder</cite> object.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>If <cite>start &gt;= end</cite>, all available samples are included
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">start</span> <span class="pre">&gt;=</span> <span class="pre">end</span></code>, all available samples are included
in the loop.</p>
</dd></dl>
<dl class="py method">
<dt id="palace.BaseDecoder.read">
<em class="property">abstract </em><code class="sig-name descname">read</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">count</span><span class="p">:</span> <span class="n">int</span></em><span class="sig-paren">)</span> &#x2192; bytes<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>
<dd><p>Decode and return <code class="xref py py-obj docutils literal notranslate"><span class="pre">count</span></code> sample frames.</p>
<p>If less than the requested count samples is returned,
the end of the audio has been reached.</p>
</dd></dl>

View File

@ -118,7 +118,7 @@
<dt id="palace.Device">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Device</code><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
<p>This can be used as a context manager that calls <a class="reference internal" href="#palace.Device.close" title="palace.Device.close"><code class="xref py py-obj docutils literal notranslate"><span class="pre">close</span></code></a> upon
completion of the block, even if an error occurs.</p>
<dl class="field-list simple">
<dt class="field-odd">Parameters</dt>
@ -176,14 +176,14 @@ extension to retrieve the audio devices real clock.</p>
<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>
<p>If HRTF is not currently enabled, this will be <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
<dl class="py 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 <cite>ALC_EXT_EFX</cite> extension is unsupported, this will be (0, 0).</p>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_EFX</span></code> extension is unsupported, this will be (0, 0).</p>
</dd></dl>
<dl class="py method">
@ -196,7 +196,7 @@ extension to retrieve the audio devices real clock.</p>
<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 <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_SOFT_HRTF</span></code> extension is unavailable,
this will return False although there could still be
HRTF applied at a lower hardware level.</p>
</dd></dl>
@ -206,8 +206,8 @@ HRTF applied at a lower hardware level.</p>
<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 <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
a given name is the ID to use with <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_HRTF_ID_SOFT</span></code>.</p>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_SOFT_HRTF</span></code> extension is unavailable,
this will be an empty list.</p>
</dd></dl>
@ -215,7 +215,7 @@ this will be an empty list.</p>
<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>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_EFX</span></code> is unsupported, this will be 0.</p>
</dd></dl>
<dl class="py method">
@ -229,8 +229,8 @@ this will be an empty list.</p>
<code class="sig-name descname">pause_dsp</code><span class="sig-paren">(</span><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 <cite>ALC_SOFT_pause_device</cite> extension.</p>
so the device will resume after one <a class="reference internal" href="#palace.Device.resume_dsp" title="palace.Device.resume_dsp"><code class="xref py py-obj docutils literal notranslate"><span class="pre">resume_dsp</span></code></a> call.</p>
<p>This requires <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_SOFT_pause_device</span></code> extension.</p>
</dd></dl>
<dl class="py method">
@ -250,7 +250,7 @@ so the device will resume after one <cite>resume_dsp</cite> call.</p>
<dt id="palace.Device.reset">
<code class="sig-name descname">reset</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">attrs</span><span class="p">:</span> <span class="n">Dict<span class="p">[</span>int<span class="p">, </span>int<span class="p">]</span></span></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 <cite>ALC_SOFT_HRTF</cite> extension is unavailable,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_SOFT_HRTF</span></code> extension is unavailable,
this will be a no-op.</p>
</dd></dl>

View File

@ -124,12 +124,12 @@ which specifies the purpose and usage of each value.</p>
<p>Instances of this class has no effect (pun intended).</p>
<p>It takes the output mix of zero or more sources,
applies DSP for the desired effect, then adds to the output mix.</p>
<p>This can be used as a context manager that calls <cite>destroy</cite>
<p>This can be used as a context manager that calls <a class="reference internal" href="#palace.BaseEffect.destroy" title="palace.BaseEffect.destroy"><code class="xref py py-obj docutils literal notranslate"><span class="pre">destroy</span></code></a>
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> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the effect is to be created.
By default <cite>current_context()</cite> is used.</p>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>
@ -168,7 +168,7 @@ it will be removed first.</p>
<dt id="palace.BaseEffect.use_count">
<em class="property">property </em><code class="sig-name descname">use_count</code><a class="headerlink" href="#palace.BaseEffect.use_count" title="Permalink to this definition"></a></dt>
<dd><p>Number of source sends the effect slot is used by.</p>
<p>This is equivalent to calling <cite>len(self.source_sends)</cite>.</p>
<p>This is equivalent to calling <code class="xref py py-obj docutils literal notranslate"><span class="pre">len(self.source_sends)</span></code>.</p>
</dd></dl>
</dd></dl>
@ -194,7 +194,7 @@ simultaneously, to create a thicker, more satisfying sound.</p>
<li><p><strong>feedback</strong> (<em>float</em>) From -1.0 to 1.0.</p></li>
<li><p><strong>delay</strong> (<em>float</em>) From 0.0 to 0.016.</p></li>
<li><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the effect is to be created.
By default <cite>current_context()</cite> is used.</p></li>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
@ -251,12 +251,12 @@ By default <cite>current_context()</cite> is used.</p></li>
<dd class="field-odd"><ul class="simple">
<li><p><strong>preset</strong> (<em>str</em><em>, </em><em>optional</em>) The initial preset to start with, falling back to GENERIC.</p></li>
<li><p><strong>context</strong> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the effect is to be created.
By default <cite>current_context()</cite> is used.</p></li>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p></li>
</ul>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><ul class="simple">
<li><p><strong>ValueError</strong> If the specified preset cannot be found in <cite>reverb_preset_names</cite>.</p></li>
<li><p><strong>ValueError</strong> If the specified preset cannot be found in <a class="reference internal" href="#palace.reverb_preset_names" title="palace.reverb_preset_names"><code class="xref py py-obj docutils literal notranslate"><span class="pre">reverb_preset_names</span></code></a>.</p></li>
<li><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p></li>
</ul>
</dd>

View File

@ -116,14 +116,14 @@
<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<span class="p">[</span>Callable<span class="p">[</span><span class="p">[</span>str<span class="p">]</span><span class="p">, </span><a class="reference internal" href="#palace.FileIO" title="palace.FileIO">palace.FileIO</a><span class="p">]</span><span class="p">]</span><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>
<p>If the default is being used, return <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code>.</p>
</dd></dl>
<dl class="py 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"><span class="n">factory</span><span class="p">:</span> <span class="n">Optional<span class="p">[</span>Callable<span class="p">[</span><span class="p">[</span>str<span class="p">]</span><span class="p">, </span><a class="reference internal" href="#palace.FileIO" title="palace.FileIO">FileIO</a><span class="p">]</span><span class="p">]</span></span></em>, <em class="sig-param"><span class="n">buffer_size</span><span class="p">:</span> <span class="n">int</span> <span class="o">=</span> <span class="default_value">8192</span></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>
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">factory=None</span></code> is provided, revert to the default.</p>
</dd></dl>
<dl class="py class">
@ -131,9 +131,9 @@
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">FileIO</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><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
palace decoders. Despite its name, a <a class="reference internal" href="#palace.FileIO" title="palace.FileIO"><code class="xref py py-obj docutils literal notranslate"><span class="pre">FileIO</span></code></a> 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>
<p>Many classes defined in the standard library module <code class="xref py py-obj docutils literal notranslate"><span class="pre">io</span></code>
are compatible with this protocol.</p>
<p class="rubric">Notes</p>
<p>Since PEP 544 is only implemented in Python 3.8+, type checking

View File

@ -119,13 +119,13 @@
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">Source</code><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,
<p>When the source is no longer needed, <a class="reference internal" href="#palace.Source.destroy" title="palace.Source.destroy"><code class="xref py py-obj docutils literal notranslate"><span class="pre">destroy</span></code></a> 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> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the source is to be created.
By default <cite>current_context()</cite> is used.</p>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>
@ -150,12 +150,12 @@ foggy air and lower values simulating dryer air; default to 0.</p>
<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>
attenuated according to <a class="reference internal" href="#palace.Source.outer_cone_gains" title="palace.Source.outer_cone_gains"><code class="xref py py-obj docutils literal notranslate"><span class="pre">outer_cone_gains</span></code></a>, default to 360.</p></li>
</ul>
</p>
</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>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <code class="xref py py-obj docutils literal notranslate"><span class="pre">inner</span></code> is greater than <code class="xref py py-obj docutils literal notranslate"><span class="pre">outer</span></code>
or either of them is outside of the [0, 360] interval.</p>
</dd>
</dl>
@ -191,7 +191,7 @@ maximum value of a single-precision floating-point variable
</p>
</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>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <code class="xref py py-obj docutils literal notranslate"><span class="pre">refdist</span></code> is greater than <code class="xref py py-obj docutils literal notranslate"><span class="pre">maxdist</span></code>
or either of them is outside of the [0, FLT_MAX] interval.</p>
</dd>
</dl>
@ -213,15 +213,15 @@ for the doppler calculation.</p>
<dl class="py 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"><span class="n">gain</span><span class="p">:</span> <span class="n">float</span></em>, <em class="sig-param"><span class="n">ms</span><span class="p">:</span> <span class="n">int</span></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>
<dd><p>Fade the source to <a class="reference internal" href="#palace.Source.gain" title="palace.Source.gain"><code class="xref py py-obj docutils literal notranslate"><span class="pre">gain</span></code></a> over <code class="xref py py-obj docutils literal notranslate"><span class="pre">ms</span></code> milliseconds.</p>
<p><a class="reference internal" href="#palace.Source.gain" title="palace.Source.gain"><code class="xref py py-obj docutils literal notranslate"><span class="pre">gain</span></code></a> is in addition to the base gain and must be within
the [0, 1] interval. <code class="xref py py-obj docutils literal notranslate"><span class="pre">ms</span></code> 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>Fading is updated during calls to <cite>Context.update</cite>,
<p>Fading is updated during calls to <a class="reference internal" href="context.html#palace.Context.update" title="palace.Context.update"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.update</span></code></a>,
which should be called regularly (30 to 50 times per second)
for the fading to be smooth.</p>
</dd></dl>
@ -259,9 +259,9 @@ for the fading to be smooth.</p>
<dl class="field-list simple">
<dt class="field-odd">Returns</dt>
<dd class="field-odd"><p><ul class="simple">
<li><p><strong>direct_hf</strong> (<em>bool</em>) Direct paths high frequency gain, default to <cite>True</cite>.</p></li>
<li><p><strong>send</strong> (<em>bool</em>) Send paths gain, default to <cite>True</cite>.</p></li>
<li><p><strong>send_hf</strong> (<em>bool</em>) Send paths high-frequency, default to <cite>True</cite>.</p></li>
<li><p><strong>direct_hf</strong> (<em>bool</em>) Direct paths high frequency gain, default to <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code>.</p></li>
<li><p><strong>send</strong> (<em>bool</em>) Send paths gain, default to <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code>.</p></li>
<li><p><strong>send_hf</strong> (<em>bool</em>) Send paths high-frequency, default to <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code>.</p></li>
</ul>
</p>
</dd>
@ -283,7 +283,7 @@ to the gain base and before the adjustments of the filter gain.</p>
</p>
</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>
<dd class="field-even"><p><strong>ValueError</strong> If set to a value where <code class="xref py py-obj docutils literal notranslate"><span class="pre">mingain</span></code> is greater than <code class="xref py py-obj docutils literal notranslate"><span class="pre">maxgain</span></code>
or either of them is outside of the [0, 1] interval.</p>
</dd>
</dl>
@ -294,15 +294,15 @@ to the gain base and before the adjustments of the filter gain.</p>
<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,
A source may only be the child of one <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> 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
<p>This is <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code> when the source does not belong to any group.
On the other hand, setting it to <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code> 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>
<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 <a class="reference internal" href="#palace.Source" title="palace.Source"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Source</span></code></a> references</p>
</dd>
</dl>
</div>
@ -312,7 +312,7 @@ from its current group.</p>
<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 <cite>AL_SOFT_source_latency</cite> extension is unsupported,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_latency</span></code> extension is unsupported,
this will be 0.</p>
</dd></dl>
@ -320,7 +320,7 @@ this will be 0.</p>
<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 <cite>AL_SOFT_source_latency</cite> extension is unsupported,
<p>If <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_latency</span></code> extension is unsupported,
this will be 0.</p>
</dd></dl>
@ -361,7 +361,7 @@ the decoders read position.</p>
</dd>
</dl>
<p class="rubric">Notes</p>
<p>Unlike <cite>AL_EXT_BFORMAT</cite> extension this property
<p>Unlike <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_EXT_BFORMAT</span></code> extension this property
comes from, this also affects the facing direction.</p>
</dd></dl>
@ -375,7 +375,7 @@ comes from, this also affects the facing direction.</p>
<li><p><strong>gain</strong> (<em>float</em>) Linear gain applying to all frequencies, default to 1.</p></li>
<li><p><strong>gain_hf</strong> (<em>float</em>) Linear gain 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>
without the <code class="xref py py-obj docutils literal notranslate"><span class="pre">ALC_EXT_EFX</span></code> extension.</p></li>
</ul>
</p>
</dd>
@ -434,7 +434,7 @@ sources are played.</p>
<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 <cite>AL_EXT_SOURCE_RADIUS</cite> extension.</p>
<p>This has no effect without <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_EXT_SOURCE_RADIUS</span></code> 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>
@ -446,8 +446,8 @@ sources are played.</p>
<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 3D parameters are relative to listener.</p>
<p>The affected parameters includes <cite>position</cite>, <cite>velocity</cite>,
and <cite>orientation</cite>.</p>
<p>The affected parameters includes <a class="reference internal" href="#palace.Source.position" title="palace.Source.position"><code class="xref py py-obj docutils literal notranslate"><span class="pre">position</span></code></a>, <a class="reference internal" href="#palace.Source.velocity" title="palace.Source.velocity"><code class="xref py py-obj docutils literal notranslate"><span class="pre">velocity</span></code></a>,
and <a class="reference internal" href="#palace.Source.orientation" title="palace.Source.orientation"><code class="xref py py-obj docutils literal notranslate"><span class="pre">orientation</span></code></a>.</p>
</dd></dl>
<dl class="py attribute">
@ -455,8 +455,8 @@ and <cite>orientation</cite>.</p>
<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>
by <code class="xref py py-obj docutils literal notranslate"><span class="pre">Context.get_available_resamplers</span></code>, and has no effect
without the <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_resampler</span></code> extension.</p>
</dd></dl>
<dl class="py method">
@ -493,9 +493,9 @@ room decay based on the reverb decay time and distance.</p></li>
<em class="property">property </em><code class="sig-name descname">sends</code><a class="headerlink" href="#palace.Source.sends" title="Permalink to this definition"></a></dt>
<dd><p>Collection of send path signals.</p>
<p>Send paths can be retrieved using a nonnegative index, which has
no effect if not less than the devices <cite>max_auxiliary_sends</cite>.</p>
no effect if not less than the devices <code class="xref py py-obj docutils literal notranslate"><span class="pre">max_auxiliary_sends</span></code>.</p>
<p>Each send path has two write-only descriptors,
<cite>effect</cite> and <cite>filter</cite>.</p>
<code class="xref py py-obj docutils literal notranslate"><span class="pre">effect</span></code> and <a class="reference internal" href="#palace.Source.filter" title="palace.Source.filter"><code class="xref py py-obj docutils literal notranslate"><span class="pre">filter</span></code></a>.</p>
<p class="rubric">Examples</p>
<div class="doctest highlight-default notranslate"><div class="highlight"><pre><span></span><span class="gp">&gt;&gt;&gt; </span><span class="n">source</span><span class="o">.</span><span class="n">sends</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span><span class="o">.</span><span class="n">effect</span> <span class="o">=</span> <span class="n">effect</span>
<span class="gp">&gt;&gt;&gt; </span><span class="n">source</span><span class="o">.</span><span class="n">sends</span><span class="p">[</span><span class="mi">1</span><span class="p">]</span><span class="o">.</span><span class="n">filter</span> <span class="o">=</span> <span class="mi">1</span><span class="p">,</span> <span class="mf">0.6</span><span class="p">,</span> <span class="mf">0.9</span>
@ -507,12 +507,12 @@ no effect if not less than the devices <cite>max_auxiliary_sends</cite>.</p>
<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>Whether to enable 3D spatialization.</p>
<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
<p>Either <code class="xref py py-obj docutils literal notranslate"><span class="pre">True</span></code> (the source always has 3D spatialization
features), <code class="xref py py-obj docutils literal notranslate"><span class="pre">False</span></code> (never has 3D spatialization features),
or <code class="xref py py-obj docutils literal notranslate"><span class="pre">None</span></code> (spatialization is enabled based on playing
a mono sound or not, default).</p>
<p>This has no effect without
<cite>AL_SOFT_source_spatialize</cite> extension.</p>
<code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_SOFT_source_spatialize</span></code> extension.</p>
</dd></dl>
<dl class="py attribute">
@ -522,7 +522,7 @@ a mono sound or not, default).</p>
<p>The angles go counter-clockwise, with 0 being in front
and positive values going left.</p>
<p>This is only used for stereo playback and has no effect
without <cite>AL_EXT_STEREO_ANGLES</cite> extension.</p>
without <code class="xref py py-obj docutils literal notranslate"><span class="pre">AL_EXT_STEREO_ANGLES</span></code> extension.</p>
</dd></dl>
<dl class="py method">
@ -548,15 +548,15 @@ by the doppler effect.</p>
<dl class="py class">
<dt id="palace.SourceGroup">
<em class="property">class </em><code class="sig-prename descclassname">palace.</code><code class="sig-name descname">SourceGroup</code><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
<dd><p>A group of <a class="reference internal" href="#palace.Source" title="palace.Source"><code class="xref py py-obj docutils literal notranslate"><span class="pre">Source</span></code></a> references.</p>
<p>For instance, setting <a class="reference internal" href="#palace.SourceGroup.gain" title="palace.SourceGroup.gain"><code class="xref py py-obj docutils literal notranslate"><span class="pre">SourceGroup.gain</span></code></a> 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
<p>This can be used as a context manager that calls <a class="reference internal" href="#palace.SourceGroup.destroy" title="palace.SourceGroup.destroy"><code class="xref py py-obj docutils literal notranslate"><span class="pre">destroy</span></code></a> 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> (<em>Optional</em><em>[</em><a class="reference internal" href="context.html#palace.Context" title="palace.Context"><em>Context</em></a><em>]</em><em>, </em><em>optional</em>) The context from which the source group is to be created.
By default <cite>current_context()</cite> is used.</p>
By default <a class="reference internal" href="context.html#palace.current_context" title="palace.current_context"><code class="xref py py-obj docutils literal notranslate"><span class="pre">current_context()</span></code></a> is used.</p>
</dd>
<dt class="field-even">Raises</dt>
<dd class="field-even"><p><strong>RuntimeError</strong> If there is neither any context specified nor current.</p>