blob: 52e00c429f6bafaaf721288a4989e22f8118cfea [file] [log] [blame] [view]
<link rel="stylesheet" href="../style.css" />
[TOC]
# fuchsia.audio.effects
<div class="fidl-version-div"><span class="fidl-attribute fidl-version">Added: 7</span></div>
## **PROTOCOLS**
## Processor {#Processor}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=26)*
<p>An audio effect processor. Consumes one or more input streams, producing one
or more output streams. On creation, this protocol must be tied to a
<a class='link' href='../fuchsia.audio.effects.Processor/'>fuchsia.audio.effects.Processor</a>/<a class='link' href='../fuchsia.audio.effects.Processor/#ProcessorConfiguration'>ProcessorConfiguration</a>, which defines
the processor's input and output streams.</p>
### Process {#Processor.Process}
<p>Processes the given number of frames. This will consume <code>num_frames</code> from
each <code>ProcessorConfiguration.inputs[i]</code> and produce an equivalent number of
frames in each <code>ProcessorConfiguration.outputs[i]</code>.</p>
<h2>Execution model</h2>
<p>All inputs and outputs must have identical frame rates. This simplifies
the problem of matching input and output frames, as described below.</p>
<p>At each call to <code>Process</code>, the effect collects audio from a set of input buffers
and produces a set of output buffers. The input buffers should be aligned by
time. That means: the first frame in each input buffer, input[i].buffer[0],
should have the same presentation time as all other frames input[j].buffer[0].</p>
<p>Output buffers with non-zero latency may be shifted relative to input buffers.
For each output k, input frame 0 has the same presentation time as the frame at
output[k].buffer[output[k].latency_frames].</p>
<ul>
<li>request <code>num_frames</code> The number of frames to process.</li>
<li>request <code>options</code> Extra options.</li>
</ul>
<ul>
<li>response <code>per_stage_metrics </code>Metrics about this process call, possibly
subdivided into multiple stages.</li>
</ul>
<ul>
<li>error A zx.status value indicating success or failure.</li>
</ul>
#### Request {#Processor.Process_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>num_frames</code></td>
<td>
<code>uint64</code>
</td>
</tr>
<tr>
<td><code>options</code></td>
<td>
<code><a class='link' href='#ProcessOptions'>ProcessOptions</a></code>
</td>
</tr>
</table>
#### Response {#Processor.Process_Response}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>result</code></td>
<td>
<code><a class='link' href='#Processor_Process_Result'>Processor_Process_Result</a></code>
</td>
</tr>
</table>
## ProcessorCreator {#ProcessorCreator}
*Defined in [fuchsia.audio.effects/creator.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/creator.fidl;l=10)*
<p>A factory for creating processors.</p>
### Create {#ProcessorCreator.Create}
<p>Create a new Processor and return it's ProcessorConfiguration.</p>
<ul>
<li>request <code>name</code> A string naming the processor to create. The meaning of this
name is up to the implementor.</li>
</ul>
<ul>
<li>response <code>processor_configuration</code> Description of the new processor.</li>
</ul>
<ul>
<li>error A zx.status value indicating success or failure.</li>
</ul>
#### Request {#ProcessorCreator.Create_Request}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>name</code></td>
<td>
<code>string[1024]</code>
</td>
</tr>
</table>
#### Response {#ProcessorCreator.Create_Response}
<table>
<tr><th>Name</th><th>Type</th></tr>
<tr>
<td><code>result</code></td>
<td>
<code><a class='link' href='#ProcessorCreator_Create_Result'>ProcessorCreator_Create_Result</a></code>
</td>
</tr>
</table>
## **STRUCTS**
### ProcessorCreator_Create_Response [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#ProcessorCreator_Create_Response data-text="ProcessorCreator_Create_Response"}
*Defined in [fuchsia.audio.effects/creator.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/creator.fidl;l=19)*
<table>
<tr><th>Field</th><th>Type</th><th>Description</th><th>Default</th></tr>
<tr id="ProcessorCreator_Create_Response.processor_configuration">
<td><code>processor_configuration</code></td>
<td>
<code><a class='link' href='#ProcessorConfiguration'>ProcessorConfiguration</a></code>
</td>
<td></td>
<td>No default</td>
</tr>
</table>
### Processor_Process_Response {#Processor_Process_Response data-text="Processor_Process_Response"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=53)*
<table>
<tr><th>Field</th><th>Type</th><th>Description</th><th>Default</th></tr>
<tr id="Processor_Process_Response.per_stage_metrics">
<td><code>per_stage_metrics</code></td>
<td>
<code>vector&lt;<a class='link' href='#ProcessMetrics'>ProcessMetrics</a>&gt;[8]</code>
</td>
<td></td>
<td>No default</td>
</tr>
</table>
## **TABLES**
### InputConfiguration [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#InputConfiguration data-text="InputConfiguration"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=145)*
<p>Configures a single input stream.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="InputConfiguration.format">
<td><h3 id="InputConfiguration.format" class="add-link hide-from-toc">1</h3></td>
<td><code>format</code></td>
<td>
<code><a class='link' href='../fuchsia.mediastreams/'>fuchsia.mediastreams</a>/<a class='link' href='../fuchsia.mediastreams/#AudioFormat'>AudioFormat</a></code>
</td>
<td><p>Format of this input stream.
Required.</p>
</td>
</tr>
<tr id="InputConfiguration.buffer">
<td><h3 id="InputConfiguration.buffer" class="add-link hide-from-toc">2</h3></td>
<td><code>buffer</code></td>
<td>
<code><a class='link' href='../fuchsia.mem/'>fuchsia.mem</a>/<a class='link' href='../fuchsia.mem/#Range'>Range</a></code>
</td>
<td><p>Buffer for this input stream. Must provide write access and must have
enough space for <code>ProcessorConfiguration.max_frames_per_call</code>.</p>
<p>Required.</p>
</td>
</tr>
</table>
### OutputConfiguration [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#OutputConfiguration data-text="OutputConfiguration"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=158)*
<p>Configures a single output stream.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="OutputConfiguration.format">
<td><h3 id="OutputConfiguration.format" class="add-link hide-from-toc">1</h3></td>
<td><code>format</code></td>
<td>
<code><a class='link' href='../fuchsia.mediastreams/'>fuchsia.mediastreams</a>/<a class='link' href='../fuchsia.mediastreams/#AudioFormat'>AudioFormat</a></code>
</td>
<td><p>Format of this output stream.
Required.</p>
</td>
</tr>
<tr id="OutputConfiguration.buffer">
<td><h3 id="OutputConfiguration.buffer" class="add-link hide-from-toc">2</h3></td>
<td><code>buffer</code></td>
<td>
<code><a class='link' href='../fuchsia.mem/'>fuchsia.mem</a>/<a class='link' href='../fuchsia.mem/#Range'>Range</a></code>
</td>
<td><p>Buffer for this output stream. Must provide write access and must have
enough space for <code>ProcessorConfiguration.max_frames_per_call</code>.
Write access is needed so the audio system can write to the output
buffer in error cases, such as when the Processor disconnects.</p>
<p>If the effect supports in-place updates, this may refer to the same memory
range as an input buffer.</p>
<p>Required.</p>
</td>
</tr>
<tr id="OutputConfiguration.latency_frames">
<td><h3 id="OutputConfiguration.latency_frames" class="add-link hide-from-toc">3</h3></td>
<td><code>latency_frames</code></td>
<td>
<code>uint64</code>
</td>
<td><p>If specified, the output signal is shifted by this many frames.
If not specified, this is zero.
See the explanation at <code>[fuchsia.audio.effects/Processor.Process]</code>.</p>
</td>
</tr>
<tr id="OutputConfiguration.ring_out_frames">
<td><h3 id="OutputConfiguration.ring_out_frames" class="add-link hide-from-toc">4</h3></td>
<td><code>ring_out_frames</code></td>
<td>
<code>uint64</code>
</td>
<td><p>If specified, then input frame F will affect the output stream up through
frame F + <code>ring_out_frames</code>. If not specified, this is zero.</p>
<p>Put differently, if the effect is given an input stream with N non-silent
frames followed by infinite silence, the effect will produce up to N +
<code>ring_out_frames</code> non-silent frames before emitting silence.</p>
</td>
</tr>
</table>
### ProcessMetrics {#ProcessMetrics data-text="ProcessMetrics"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=82)*
<p>An extensible container of metrics about a single Processor.Process call.
All fields are optional.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="ProcessMetrics.name">
<td><h3 id="ProcessMetrics.name" class="add-link hide-from-toc">1</h3></td>
<td><code>name</code></td>
<td>
<code>string[64]</code>
</td>
<td><p>Each process call may be (optionally) divided into multiple stages,
each with their own ProcessMetrics. This field names the stage described
by this table.</p>
</td>
</tr>
<tr id="ProcessMetrics.wall_time">
<td><h3 id="ProcessMetrics.wall_time" class="add-link hide-from-toc">2</h3></td>
<td><code>wall_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#duration'>duration</a></code>
</td>
<td><p>Total wall-clock time from the moment the Process call is received to
the moment a response is returned.</p>
</td>
</tr>
<tr id="ProcessMetrics.cpu_time">
<td><h3 id="ProcessMetrics.cpu_time" class="add-link hide-from-toc">3</h3></td>
<td><code>cpu_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#duration'>duration</a></code>
</td>
<td><p>Total amount of time spent running on the CPU.
See zx_info_task_runtime.cpu_time.</p>
</td>
</tr>
<tr id="ProcessMetrics.queue_time">
<td><h3 id="ProcessMetrics.queue_time" class="add-link hide-from-toc">4</h3></td>
<td><code>queue_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#duration'>duration</a></code>
</td>
<td><p>Total amount of time spent waiting to run. Only counts &quot;ready&quot; time.
See zx_info_task_runtime.queue_time.</p>
</td>
</tr>
<tr id="ProcessMetrics.page_fault_time">
<td><h3 id="ProcessMetrics.page_fault_time" class="add-link hide-from-toc">5</h3></td>
<td><code>page_fault_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#duration'>duration</a></code>
</td>
<td><p>Total amount of time spent handling page faults.
See zx_info_task_runtime.page_fault_time.</p>
</td>
</tr>
<tr id="ProcessMetrics.kernel_lock_contention_time">
<td><h3 id="ProcessMetrics.kernel_lock_contention_time" class="add-link hide-from-toc">6</h3></td>
<td><code>kernel_lock_contention_time</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#duration'>duration</a></code>
</td>
<td><p>Total amount of time spent waiting on contended kernel locks.
See zx_info_task_runtime.lock_contention_time.</p>
</td>
</tr>
</table>
### ProcessOptions {#ProcessOptions data-text="ProcessOptions"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=59)*
<p>An extensible container of options for Processor.Process.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="ProcessOptions.total_applied_gain_db_per_input">
<td><h3 id="ProcessOptions.total_applied_gain_db_per_input" class="add-link hide-from-toc">1</h3></td>
<td><code>total_applied_gain_db_per_input</code></td>
<td>
<code>vector&lt;float32&gt;[8]</code>
</td>
<td><p>The total gain that has been applied to each input stream by prior
processing steps. For example, given an audio pipeline of the form input -&gt;
ProcessorA -&gt; ProcessorB, if input is a sine wave with unity amplitude and
ProcessorA applies a gain of -5.0dB, then ProcessorB should be called with
total_applied_gain_db_per_input[0] = -5.0dB and ProcessorB's input buffer
should contain a sine wave with amplitude -5.0dB.</p>
<p>If not specified, the applied gain is 0 dB for each input.</p>
</td>
</tr>
<tr id="ProcessOptions.usage_mask_per_input">
<td><h3 id="ProcessOptions.usage_mask_per_input" class="add-link hide-from-toc">2</h3></td>
<td><code>usage_mask_per_input</code></td>
<td>
<code>vector&lt;uint32&gt;[8]</code>
</td>
<td><p>All fuchsia.media.AudioRenderUsages that contribute to each input
stream. This is a bitmask of (1 &lt;&lt; r), for each AudioRenderUsage that
contributes. For example, if an input stream contains BACKGROUND (== 0)
and INTERRUPTION (== 2), the bitmask is ((1&lt;&lt;0)|(1&lt;&lt;2)) = 0x5.</p>
<p>Note: this field may be removed once we have transitions to the new
Fuchsia media APIs.</p>
</td>
</tr>
</table>
### ProcessorConfiguration [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#ProcessorConfiguration data-text="ProcessorConfiguration"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=110)*
<p>Configures a Processor.</p>
<table>
<tr><th>Ordinal</th><th>Field</th><th>Type</th><th>Description</th></tr>
<tr id="ProcessorConfiguration.processor">
<td><h3 id="ProcessorConfiguration.processor" class="add-link hide-from-toc">1</h3></td>
<td><code>processor</code></td>
<td>
<code><a class='link' href='#Processor'>Processor</a></code>
</td>
<td><p>Dedicated FIDL channel for this processor.
Required.</p>
</td>
</tr>
<tr id="ProcessorConfiguration.inputs">
<td><h3 id="ProcessorConfiguration.inputs" class="add-link hide-from-toc">2</h3></td>
<td><code>inputs</code></td>
<td>
<code>vector&lt;<a class='link' href='#InputConfiguration'>InputConfiguration</a>&gt;[8]</code>
</td>
<td><p>A description of all input streams for this processor.
Must have at least one input.</p>
<p>Each input stream can have a different sample format or channel count, but
all inputs must have the same frame rate.</p>
</td>
</tr>
<tr id="ProcessorConfiguration.outputs">
<td><h3 id="ProcessorConfiguration.outputs" class="add-link hide-from-toc">3</h3></td>
<td><code>outputs</code></td>
<td>
<code>vector&lt;<a class='link' href='#OutputConfiguration'>OutputConfiguration</a>&gt;[8]</code>
</td>
<td><p>A description of all output streams for this processor.
Must have at least one output.</p>
<p>Each output stream can have a different sample format or channel count,
but all outputs must have the same frame rate as the input(s) -- effects
are allowed to perform sample format conversion and rechannelization as
long as the frame rate does not change.</p>
</td>
</tr>
<tr id="ProcessorConfiguration.max_frames_per_call">
<td><h3 id="ProcessorConfiguration.max_frames_per_call" class="add-link hide-from-toc">4</h3></td>
<td><code>max_frames_per_call</code></td>
<td>
<code>uint64</code>
</td>
<td><p>The maximum number of frames that may be processed per call to
<a class='link' href='../fuchsia.audio.effects/'>fuchsia.audio.effects</a>/<a class='link' href='../fuchsia.audio.effects/#Processor.Process'>Processor.Process</a>. The default limit is the
number of frames that can fit in the smallest input buffer. If specified,
this must be smaller than the default limit.</p>
</td>
</tr>
<tr id="ProcessorConfiguration.block_size_frames">
<td><h3 id="ProcessorConfiguration.block_size_frames" class="add-link hide-from-toc">5</h3></td>
<td><code>block_size_frames</code></td>
<td>
<code>uint64</code>
</td>
<td><p>If specified, all calls to <a class='link' href='../fuchsia.audio.effects/'>fuchsia.audio.effects</a>/<a class='link' href='../fuchsia.audio.effects/#Processor.Process'>Processor.Process</a>.
must set <code>num_frames</code> to a multiple of this number. Must be less than or
equal to <code>max_frames_per_call</code>. If not specified, then any block size is
allowed.</p>
</td>
</tr>
</table>
## **UNIONS**
### ProcessorCreator_Create_Result [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} [resource](/fuchsia-src/reference/fidl/language/language.md#value-vs-resource){:.fidl-attribute} {#ProcessorCreator_Create_Result data-text="ProcessorCreator_Create_Result"}
*Defined in [fuchsia.audio.effects/creator.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/creator.fidl;l=19)*
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="ProcessorCreator_Create_Result.response">
<td><h3 id="ProcessorCreator_Create_Result.response" class="add-link hide-from-toc">1</h3></td>
<td><code>response</code></td>
<td>
<code><a class='link' href='#ProcessorCreator_Create_Response'>ProcessorCreator_Create_Response</a></code>
</td>
<td></td>
</tr>
<tr id="ProcessorCreator_Create_Result.err">
<td><h3 id="ProcessorCreator_Create_Result.err" class="add-link hide-from-toc">2</h3></td>
<td><code>err</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#status'>status</a></code>
</td>
<td></td>
</tr>
</table>
### Processor_Process_Result [strict](/fuchsia-src/reference/fidl/language/language.md#strict-vs-flexible){:.fidl-attribute} {#Processor_Process_Result data-text="Processor_Process_Result"}
*Defined in [fuchsia.audio.effects/processor.fidl](https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=53)*
<table>
<tr><th>Ordinal</th><th>Variant</th><th>Type</th><th>Description</th></tr>
<tr id="Processor_Process_Result.response">
<td><h3 id="Processor_Process_Result.response" class="add-link hide-from-toc">1</h3></td>
<td><code>response</code></td>
<td>
<code><a class='link' href='#Processor_Process_Response'>Processor_Process_Response</a></code>
</td>
<td></td>
</tr>
<tr id="Processor_Process_Result.err">
<td><h3 id="Processor_Process_Result.err" class="add-link hide-from-toc">2</h3></td>
<td><code>err</code></td>
<td>
<code><a class='link' href='../zx/'>zx</a>/<a class='link' href='../zx/#status'>status</a></code>
</td>
<td></td>
</tr>
</table>
## **CONSTANTS**
<table>
<tr><th>Name</th><th>Value</th><th>Type</th><th>Description</th></tr>
<tr id="MAX_INPUT_STREAMS">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=13">MAX_INPUT_STREAMS</a></td>
<td>
<code>8</code>
</td>
<td><code>uint32</code></td>
<td><p>The maximum number of input and output streams.
These bounds are somewhat arbitrary; in practice we don't expect more than 1
or 2 inputs and outputs in the vast majority of cases.</p>
</td>
</tr>
<tr id="MAX_OUTPUT_STREAMS">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=14">MAX_OUTPUT_STREAMS</a></td>
<td>
<code>8</code>
</td>
<td><code>uint32</code></td>
<td></td>
</tr>
<tr id="MAX_PROCESS_STAGES">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=17">MAX_PROCESS_STAGES</a></td>
<td>
<code>8</code>
</td>
<td><code>uint32</code></td>
<td><p>The maximum size of the per_stage_metrics array.</p>
</td>
</tr>
<tr id="MAX_PROCESS_STAGE_NAME_LENGTH">
<td><a href="https://cs.opensource.google/fuchsia/fuchsia/+/main:sdk/fidl/fuchsia.audio.effects/processor.fidl;l=20">MAX_PROCESS_STAGE_NAME_LENGTH</a></td>
<td>
<code>64</code>
</td>
<td><code>uint32</code></td>
<td><p>The maximum length of the name of a process stage.</p>
</td>
</tr>
</table>