aboutsummaryrefslogtreecommitdiff
path: root/en/devices/audio
diff options
context:
space:
mode:
Diffstat (limited to 'en/devices/audio')
-rw-r--r--en/devices/audio/attributes.html2
-rw-r--r--en/devices/audio/data_formats.html4
-rw-r--r--en/devices/audio/debugging.html69
-rw-r--r--en/devices/audio/latency_app.html2
-rw-r--r--en/devices/audio/midi.html2
-rw-r--r--en/devices/audio/midi_test.html6
-rw-r--r--en/devices/audio/tv.html26
-rw-r--r--en/devices/audio/usb.html10
-rw-r--r--en/devices/audio/warmup.html4
9 files changed, 66 insertions, 59 deletions
diff --git a/en/devices/audio/attributes.html b/en/devices/audio/attributes.html
index b685e8bf..61825c00 100644
--- a/en/devices/audio/attributes.html
+++ b/en/devices/audio/attributes.html
@@ -135,7 +135,7 @@ audio attribute API</a>.</p>
<p>In this example, AudioAttributes.Builder defines the AudioAttributes to be used by a new
AudioTrack instance:</p>
-<pre>
+<pre class="devsite-click-to-copy">
AudioTrack myTrack = new AudioTrack(
new AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_MEDIA)
diff --git a/en/devices/audio/data_formats.html b/en/devices/audio/data_formats.html
index e11a1abf..382c9567 100644
--- a/en/devices/audio/data_formats.html
+++ b/en/devices/audio/data_formats.html
@@ -118,7 +118,7 @@ for all signed fixed-point representations,
so the following holds where all values are in units of one
<a href="https://en.wikipedia.org/wiki/Least_significant_bit">LSB</a>:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
|largest negative value| = |largest positive value| + 1
</pre>
@@ -306,7 +306,7 @@ To convert a value from Q<em>m</em>.<em>n</em> format to floating point:
<p>
For example, to convert a Q4.27 internal value to floating point, use:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
float = integer * (2 ^ -27)
</pre>
diff --git a/en/devices/audio/debugging.html b/en/devices/audio/debugging.html
index 9f8efb79..67e23d03 100644
--- a/en/devices/audio/debugging.html
+++ b/en/devices/audio/debugging.html
@@ -50,30 +50,31 @@ For Android 7.x, replace <code>/data/misc/media</code> with
<code>/data/misc/audioserver</code>.
Additionally, you must use a userdebug or eng build.
If you use a userdebug build, then disable verity with:</p>
-<pre>
-<code>$ adb root &amp;&amp; adb disable-verity &amp;&amp; adb reboot</code>
+
+<pre class="devsite-terminal devsite-click-to-copy">
+adb root &amp;&amp; adb disable-verity &amp;&amp; adb reboot
</pre>
<h3 id="compile">Compile-time setup</h3>
<ol>
-<li><code>$ cd frameworks/av/services/audioflinger</code></li>
+ <li><code class="devsite-terminal">cd frameworks/av/services/audioflinger</code></li>
<li>Edit <code>Configuration.h</code>.</li>
<li>Uncomment <code>#define TEE_SINK</code>.</li>
<li>Re-build <code>libaudioflinger.so</code>.</li>
-<li><code>$ adb root</code></li>
-<li><code>$ adb remount</code></li>
+<li><code class="devsite-terminal">adb root</code></li>
+<li><code class="devsite-terminal">adb remount</code></li>
<li>Push or sync the new <code>libaudioflinger.so</code> to the device's <code>/system/lib</code>.</li>
</ol>
<h3 id="runtime">Run-time setup</h3>
<ol>
-<li><code>$ adb shell getprop | grep ro.debuggable</code>
+<li><code class="devsite-terminal">adb shell getprop | grep ro.debuggable</code>
<br />Confirm that the output is: <code>[ro.debuggable]: [1]</code>
</li>
-<li><code>$ adb shell</code></li>
-<li><code>$ ls -ld /data/misc/media</code>
+<li><code class="devsite-terminal">adb shell</code></li>
+<li><code class="devsite-terminal">ls -ld /data/misc/media</code>
<br />
<p>
Confirm that the output is:
@@ -81,20 +82,19 @@ Confirm that the output is:
<pre>
drwx------ media media ... media
</pre>
-<br />
<p>
If the directory does not exist, create it as follows:
</p>
-<pre>
-$ mkdir /data/misc/media
-$ chown media:media /data/misc/media
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">mkdir /data/misc/media</code>
+<code class="devsite-terminal">chown media:media /data/misc/media</code>
</pre>
</li>
-<li><code>$ echo af.tee=# &gt; /data/local.prop</code>
+<li><code class="devsite-terminal">echo af.tee=# &gt; /data/local.prop</code>
<br />Where the <code>af.tee</code> value is a number described below.
</li>
-<li><code>$ chmod 644 /data/local.prop</code></li>
-<li><code>$ reboot</code></li>
+<li><code class="devsite-terminal">chmod 644 /data/local.prop</code></li>
+<li><code class="devsite-terminal">reboot</code></li>
</ol>
<h4>Values for <code>af.tee</code> property</h4>
@@ -120,7 +120,7 @@ but you can get similar results using "4."
<ol>
<li>Run your audio test.</li>
-<li><code>$ adb shell dumpsys media.audio_flinger</code></li>
+<li><code class="devsite-terminal">adb shell dumpsys media.audio_flinger</code></li>
<li>Look for a line in dumpsys output such as this:<br />
<code>tee copied to /data/misc/media/20131010101147_2.wav</code>
<br />This is a PCM .wav file.
@@ -165,10 +165,10 @@ Restore your build and device as follows:
<li>Push or sync the restored <code>libaudioflinger.so</code>
to the device's <code>/system/lib</code>.
</li>
-<li><code>$ adb shell</code></li>
-<li><code>$ rm /data/local.prop</code></li>
-<li><code>$ rm /data/misc/media/*.wav</code></li>
-<li><code>$ reboot</code></li>
+<li><code class="devsite-terminal">adb shell</code></li>
+<li><code class="devsite-terminal">rm /data/local.prop</code></li>
+<li><code class="devsite-terminal">rm /data/misc/media/*.wav</code></li>
+<li><code class="devsite-terminal">reboot</code></li>
</ol>
<h2 id="mediaLog">media.log</h2>
@@ -345,7 +345,7 @@ First, you need to add logs to your code.
<p>
In <code>FastMixer</code> and <code>FastCapture</code> threads, use code such as this:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
logWriter-&gt;log("string");
logWriter-&gt;logf("format", parameters);
logWriter-&gt;logTimestamp();
@@ -359,7 +359,7 @@ there is no need for mutual exclusion.
<p>
In other AudioFlinger threads, use <code>mNBLogWriter</code>:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
mNBLogWriter-&gt;log("string");
mNBLogWriter-&gt;logf("format", parameters);
mNBLogWriter-&gt;logTimestamp();
@@ -397,19 +397,19 @@ The full <code>NBLog</code> API is at <code>frameworks/av/include/media/nbaio/NB
<code>ro.test_harness</code> is <code>1</code>. You can enable it by:
</p>
-<pre>
-$ adb root
-$ adb shell
-$ echo ro.test_harness=1 > /data/local.prop
-$ chmod 644 /data/local.prop
-$ reboot
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb root</code>
+<code class="devsite-terminal">adb shell</code>
+<code class="devsite-terminal">echo ro.test_harness=1 > /data/local.prop</code>
+<code class="devsite-terminal">chmod 644 /data/local.prop</code>
+<code class="devsite-terminal">reboot</code>
</pre>
<p>
The connection is lost during reboot, so:
</p>
-<pre>
-$ adb shell
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell
</pre>
The command <code>ps media</code> will now show two processes:
@@ -427,8 +427,8 @@ Note the process ID of <code>mediaserver</code> for later.
You can manually request a log dump at any time.
This command shows logs from all the active and recent timelines, and then clears them:
</p>
-<pre>
-$ dumpsys media.log
+<pre class="devsite-terminal devsite-click-to-copy">
+dumpsys media.log
</pre>
<p>
@@ -443,8 +443,9 @@ Now try killing <code>mediaserver</code> process: <code>kill -9 #</code>, where
the process ID you noted earlier. You should see a dump from <code>media.log</code>
in the main <code>logcat</code>, showing all the logs leading up to the crash.
</p>
-<pre>
-$ dumpsys media.log
+
+<pre class="devsite-terminal devsite-click-to-copy">
+dumpsys media.log
</pre>
</body>
diff --git a/en/devices/audio/latency_app.html b/en/devices/audio/latency_app.html
index b4e7495b..61a1c56f 100644
--- a/en/devices/audio/latency_app.html
+++ b/en/devices/audio/latency_app.html
@@ -104,7 +104,7 @@ The document "OpenSL ES for Android" is provided in the NDK installation,
and is not currently available online. Open this link in a browser:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
NDKroot/docs/Additional_library_docs/opensles/index.html
</pre>
diff --git a/en/devices/audio/midi.html b/en/devices/audio/midi.html
index 31b55182..ecebb012 100644
--- a/en/devices/audio/midi.html
+++ b/en/devices/audio/midi.html
@@ -153,7 +153,7 @@ Applications can screen for the presence of MIDI support using the
<p>
To claim MIDI support, add this line to your <code>device.mk</code>:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
PRODUCT_COPY_FILES += \
frameworks/native/data/etc/android.software.midi.xml:system/etc/permissions/android.software.midi.xml
</pre>
diff --git a/en/devices/audio/midi_test.html b/en/devices/audio/midi_test.html
index 303f0980..d6531f98 100644
--- a/en/devices/audio/midi_test.html
+++ b/en/devices/audio/midi_test.html
@@ -104,9 +104,9 @@ For example, to install the <em>MidiScope</em> app:</p>
<li> On the workstation, enter:</li>
</ol>
-<pre>
-cd <em>&lt;this-folder&gt;</em>
-adb install -r MidiScope.apk
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">cd <var>THIS_FOLDER</var></code>
+<code class="devsite-terminal">adb install -r MidiScope.apk</code>
</pre>
diff --git a/en/devices/audio/tv.html b/en/devices/audio/tv.html
index 29c95bb5..61bdbe4e 100644
--- a/en/devices/audio/tv.html
+++ b/en/devices/audio/tv.html
@@ -73,12 +73,12 @@ of all the TV output (11Khz, 16bit mono or 48Khz, 16bit mono). Used only for aud
<p>Android supports the following audio devices for TV audio input/output.</p>
-<h4>system/media/audio/include/system/audio.h</h4>
+<h4><code>system/media/audio/include/system/audio.h</code></h4>
<p class="note"><strong>Note:</strong> In Android 5.1 and earlier, the path to
this file is: <code>system/core/include/system/audio.h</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
/* output devices */
AUDIO_DEVICE_OUT_AUX_DIGITAL = 0x400,
AUDIO_DEVICE_OUT_HDMI = AUDIO_DEVICE_OUT_AUX_DIGITAL,
@@ -101,12 +101,12 @@ AUDIO_DEVICE_IN_LOOPBACK = AUDIO_DEVICE_BIT_IN | 0x40000,
<p>The Audio HAL extension for the audio routing API is defined by following:</p>
-<h4>system/media/audio/include/system/audio.h</h4>
+<h4><code>system/media/audio/include/system/audio.h</code></h4>
<p class="note"><strong>Note:</strong> In Android 5.1 and earlier, the path to
this file is: <code>system/core/include/system/audio.h</code></p>
-<pre>
+<pre class="devsite-click-to-copy">
/* audio port configuration structure used to specify a particular configuration of an audio port */
struct audio_port_config {
audio_port_handle_t id; /* port unique ID */
@@ -144,9 +144,9 @@ struct audio_port {
};
</pre>
-<h4>hardware/libhardware/include/hardware/audio.h</h4>
+<h4><code>hardware/libhardware/include/hardware/audio.h</code></h4>
-<pre>
+<pre class="devsite-click-to-copy">
struct audio_hw_device {
:
/**
@@ -185,9 +185,9 @@ struct audio_hw_device {
<p>To test DEVICE_IN_LOOPBACK for TV monitoring, use the following testing code. After running the
test, the captured audio saves to <code>/sdcard/record_loopback.raw</code>, where you can listen to
-it using <code>ffmeg</code>.</p>
+it using <code><a href="https://en.wikipedia.org/wiki/FFmpeg">FFmpeg</a></code>.</p>
-<pre>
+<pre class="devsite-click-to-copy">
&lt;uses-permission android:name="android.permission.MODIFY_AUDIO_ROUTING" /&gt;
&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
@@ -267,12 +267,12 @@ it using <code>ffmeg</code>.</p>
</pre>
<p>Locate the captured audio file in <code>/sdcard/record_loopback.raw</code> and listen to it using
-<code>ffmeg</code>:</p>
+<code>FFmpeg</code>:</p>
-<pre>
-adb pull /sdcard/record_loopback.raw
-ffmpeg -f s16le -ar 48k -ac 1 -i record_loopback.raw record_loopback.wav
-ffplay record_loopback.wav
+<pre class="devsite-click-to-copy">
+<code class="devsite-terminal">adb pull /sdcard/record_loopback.raw</code>
+<code class="devsite-terminal">ffmpeg -f s16le -ar 48k -ac 1 -i record_loopback.raw record_loopback.wav</code>
+<code class="devsite-terminal">ffplay record_loopback.wav</code>
</pre>
<h2 id="useCases">Use cases</h2>
diff --git a/en/devices/audio/usb.html b/en/devices/audio/usb.html
index f1c99ff6..d1dfcd3e 100644
--- a/en/devices/audio/usb.html
+++ b/en/devices/audio/usb.html
@@ -572,7 +572,9 @@ To enable USB audio, add an entry to the
audio policy configuration file. This is typically
located here:
</p>
-<pre>device/oem/codename/audio_policy.conf</pre>
+<pre class="devsite-click-to-copy">
+device/oem/codename/audio_policy.conf
+</pre>
<p>
The pathname component "oem" should be replaced by the name
of the OEM who manufactures the Android device,
@@ -583,7 +585,7 @@ and "codename" should be replaced by the device code name.
An example entry is shown here:
</p>
-<pre>
+<pre class="devsite-click-to-copy">
audio_hw_modules {
...
usb {
@@ -620,7 +622,9 @@ audio_hw_modules {
The audio Hardware Abstraction Layer (HAL)
implementation for USB audio is located here:
</p>
-<pre>hardware/libhardware/modules/usbaudio/</pre>
+<pre class="devsite-click-to-copy">
+hardware/libhardware/modules/usbaudio/
+</pre>
<p>
The USB audio HAL relies heavily on
<i>tinyalsa</i>, described at <a href="terminology.html">Audio Terminology</a>.
diff --git a/en/devices/audio/warmup.html b/en/devices/audio/warmup.html
index e139e2f4..7c37cd66 100644
--- a/en/devices/audio/warmup.html
+++ b/en/devices/audio/warmup.html
@@ -54,7 +54,9 @@ Layer (HAL) <code>write()</code> takes to stabilize.
the hardware itself might have its own power logic beyond the three seconds that AudioFlinger has.</li>
<li>Press Home, and you should hear a click sound.</li>
<li>Run the following command to receive the measured warmup:
- <br /><code>adb shell dumpsys media.audio_flinger | grep measuredWarmup</code>
+<pre class="devsite-terminal devsite-click-to-copy">
+adb shell dumpsys media.audio_flinger | grep measuredWarmup
+</pre>
<p>
You should see output like this: