FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Frequency test instructions by HoangHongHieu · Pull Request #2386 · google/oboe · GitHub

/ oboe Public
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .java  (4) .xml  (3) All 2 file types selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public class DualFrequencyActivity extends AnalyzerActivity {
private int mBottomThresholdLineId = -1;
private TextView mTestStatusView;
private TextView mTestResultView;
private TextView mInstructionsView;
private FrequencySettingView mFrequencySetting;
private StreamConfigurationView mInputConfigView;
private FrequencyAnalyzer mFrequencyAnalyzer = new FrequencyAnalyzer();
Expand Down Expand Up @@ -70,6 +71,7 @@ protected void onCreate(Bundle savedInstanceState) {
mStopButton2 = findViewById(R.id.button_stop_2);
mTestStatusView = findViewById(R.id.testStatusView);
mTestResultView = findViewById(R.id.testResultView);
mInstructionsView = findViewById(R.id.test_dual_frequency_instructions);

mInputConfigView = null;
StreamConfigurationView outputConfigView = null;
Expand Down Expand Up @@ -97,6 +99,9 @@ public void onSettingChanged() {
mAudioOutTester.setSignalType(
FrequencySettingView.getSignalIndexForSource(
active.sourceResId));
if (mInstructionsView != null) {
mInstructionsView.setText(active.instructionsResId);
}
}
}
});
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@

package com.mobileer.oboetester;

import android.os.Bundle;
import android.media.AudioDeviceInfo;
import android.os.Bundle;
import android.os.Handler;
import android.text.method.LinkMovementMethod;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.Spinner;
import android.widget.TextView;
import android.widget.EditText;
import android.widget.AdapterView;
import androidx.core.text.HtmlCompat;
import java.io.IOException;
import android.os.Handler;

public final class FrequencyActivity extends AnalyzerActivity {

Expand All @@ -39,6 +42,7 @@ public final class FrequencyActivity extends AnalyzerActivity {
private int mAvgMagLineId = -1;
private TextView mTestResultView;
private EditText mThresholdEditText;
private TextView mInstructionsView;

private Spinner mOutputSignalSpinner;
private FrequencySettingView mFrequencySetting;
Expand All @@ -65,6 +69,10 @@ protected void onCreate(Bundle savedInstanceState) {
mShareButton = (Button) findViewById(R.id.button_share);
mTestResultView = (TextView) findViewById(R.id.testResultView);
mThresholdEditText = (EditText) findViewById(R.id.thresholdEditText);
mInstructionsView = (TextView) findViewById(R.id.test_frequency_instructions);
if (mInstructionsView != null) {
mInstructionsView.setMovementMethod(LinkMovementMethod.getInstance());
}

mLineView = findViewById(R.id.line_view);
mLineView.setUnits("Hz", "dBFS");
Expand Down Expand Up @@ -154,6 +162,23 @@ public void onSettingChanged() {
active.sourceResId));
mBalanceSeekBar.setProgress((int) (active.balance * 100));
mThresholdEditText.setText(String.valueOf(active.passThreshold));

if (mInstructionsView != null) {
if (active.instructionsResId != 0) {
mInstructionsView.setText(HtmlCompat.fromHtml(
getString(active.instructionsResId),
HtmlCompat.FROM_HTML_MODE_LEGACY));
} else {
mInstructionsView.setText("");
Comment thread
robertwu1 marked this conversation as resolved.
Log.w(TAG, "Preset " + active.name + " has no instruction");
}
}
} else {
if (mInstructionsView != null) {
mInstructionsView.setText(HtmlCompat.fromHtml(
getString(R.string.test_frequency_default_instructions),
HtmlCompat.FROM_HTML_MODE_LEGACY));
}
}
}
});
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,14 @@ public enum Band1CheckType {
final public int preferredOutput;
final public Band1CheckType band1CheckType;
final public float band1Threshold;
final public int instructionsResId;

public FrequencyPreset(String name, int sourceResId, int inputPreset, int[] anchors,
public FrequencyPreset(String name, int instructionsResId, int sourceResId, int inputPreset, int[] anchors,
List<FrequencyBandSpec.BandThreshold> bands, float passThreshold, int preferredInput,
int preferredOutput, Band1CheckType band1CheckType, float band1Threshold,
float balance) {
this.name = name;
this.instructionsResId = instructionsResId;
this.sourceResId = sourceResId;
this.inputPreset = inputPreset;
this.anchors = anchors;
Expand All @@ -55,17 +57,17 @@ public FrequencyPreset(String name, int sourceResId, int inputPreset, int[] anch
this.band1Threshold = band1Threshold;
}

public FrequencyPreset(String name, int sourceResId, int inputPreset, int[] anchors,
public FrequencyPreset(String name, int instructionsResId, int sourceResId, int inputPreset, int[] anchors,
List<FrequencyBandSpec.BandThreshold> bands, float passThreshold, int preferredInput,
int preferredOutput, Band1CheckType band1CheckType, float band1Threshold) {
this(name, sourceResId, inputPreset, anchors, bands, passThreshold, preferredInput,
this(name, instructionsResId, sourceResId, inputPreset, anchors, bands, passThreshold, preferredInput,
preferredOutput, band1CheckType, band1Threshold, 0.5f);
}

public FrequencyPreset(String name, int sourceResId, int inputPreset, int[] anchors,
public FrequencyPreset(String name, int instructionsResId, int sourceResId, int inputPreset, int[] anchors,
List<FrequencyBandSpec.BandThreshold> bands, float passThreshold, int preferredInput,
int preferredOutput) {
this(name, sourceResId, inputPreset, anchors, bands, passThreshold, preferredInput,
this(name, instructionsResId, sourceResId, inputPreset, anchors, bands, passThreshold, preferredInput,
preferredOutput, Band1CheckType.NONE, 0.0f, 0.5f);
}

Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,20 @@ private void setupFrequencyPresets() {
bands1.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -50.0f, -50.0f));
bands1.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -50.0f, -50.0f));
mPresets.add(new FrequencyPreset("Background Test",
R.string.test_frequency_background_instructions,
R.string.source_silence, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{50, 100, 4000, 12000, 20000}, bands1, 30.0f,
AudioDeviceInfo.TYPE_UNKNOWN, AudioDeviceInfo.TYPE_UNKNOWN,
FrequencyPreset.Band1CheckType.LESS_THAN, -60.0f));

// 2. Loopback Dongle
List<FrequencyBandSpec.BandThreshold> bands2 = new ArrayList<>();
bands2.add(new FrequencyBandSpec.BandThreshold(4.0f, 4.0f, -50.0f, -4.0f));
bands2.add(new FrequencyBandSpec.BandThreshold(4.0f, 4.0f, -4.0f, -4.0f));
bands2.add(new FrequencyBandSpec.BandThreshold(4.0f, 5.0f, -4.0f, -5.0f));
bands2.add(new FrequencyBandSpec.BandThreshold(5.0f, 5.0f, -5.0f, -30.0f));
mPresets.add(new FrequencyPreset("Loopback Dongle",
R.string.test_frequency_loopback_dongle_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_UNPROCESSED,
new int[]{50, 500, 4000, 12000, 20000}, bands2, 30.0f,
AudioDeviceInfo.TYPE_USB_HEADSET, AudioDeviceInfo.TYPE_USB_HEADSET,
Expand All @@ -69,6 +72,7 @@ private void setupFrequencyPresets() {
bands3.add(new FrequencyBandSpec.BandThreshold(10.0f, 10.0f, -50.0f, -10.0f));
bands3.add(new FrequencyBandSpec.BandThreshold(-30.0f, -30.0f, -120.0f, -120.0f));
mPresets.add(new FrequencyPreset("Unprocessed Tone test",
R.string.test_frequency_unprocessed_tone_instructions,
R.string.source_sine, StreamConfiguration.INPUT_PRESET_UNPROCESSED,
new int[]{30, 900, 1100, 20000}, bands3, 50.0f,
AudioDeviceInfo.TYPE_BUILTIN_MIC, AudioDeviceInfo.TYPE_USB_DEVICE));
Expand All @@ -79,6 +83,7 @@ private void setupFrequencyPresets() {
bands4.add(new FrequencyBandSpec.BandThreshold(10.0f, 10.0f, -50.0f, -10.0f));
bands4.add(new FrequencyBandSpec.BandThreshold(-30.0f, -30.0f, -120.0f, -120.0f));
mPresets.add(new FrequencyPreset("Voice Recognition Tone test",
R.string.test_frequency_voice_recognition_tone_instructions,
R.string.source_sine, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{5, 900, 1100, 20000}, bands4, 50.0f,
AudioDeviceInfo.TYPE_BUILTIN_MIC, AudioDeviceInfo.TYPE_USB_DEVICE));
Expand All @@ -90,13 +95,15 @@ private void setupFrequencyPresets() {
bands5.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -30.0f, -30.0f));
bands5.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -30.0f, -30.0f));
mPresets.add(new FrequencyPreset("Built-in Mic and External Speaker",
R.string.test_frequency_builtin_mic_and_external_speaker_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{30, 100, 4000, 12000, 20000}, bands5, 30.0f,
AudioDeviceInfo.TYPE_BUILTIN_MIC, AudioDeviceInfo.TYPE_USB_DEVICE,
FrequencyPreset.Band1CheckType.GREATER_THAN, -50.0f));

// 6. External Mic and External Speaker
mPresets.add(new FrequencyPreset("External Mic and External Speaker",
R.string.test_frequency_external_mic_and_external_speaker_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{30, 100, 4000, 12000, 20000}, bands5, 30.0f,
AudioDeviceInfo.TYPE_USB_DEVICE, AudioDeviceInfo.TYPE_USB_DEVICE,
Expand All @@ -109,13 +116,15 @@ private void setupFrequencyPresets() {
bands7.add(new FrequencyBandSpec.BandThreshold(4.0f, 10.0f, -4.0f, -10.0f));
bands7.add(new FrequencyBandSpec.BandThreshold(10.0f, 10.0f, -10.0f, -40.0f));
mPresets.add(new FrequencyPreset("External Mic and Left Built-in Speaker",
R.string.test_frequency_external_mic_and_left_builtin_speaker_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{50, 500, 4000, 12000, 20000}, bands7, 30.0f,
AudioDeviceInfo.TYPE_USB_DEVICE, AudioDeviceInfo.TYPE_BUILTIN_SPEAKER,
FrequencyPreset.Band1CheckType.GREATER_THAN, -50.0f, 0.0f));

// 8. External Mic and Right Built-in Speaker
mPresets.add(new FrequencyPreset("External Mic and Right Built-in Speaker",
R.string.test_frequency_external_mic_and_right_builtin_speaker_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{50, 500, 4000, 12000, 20000}, bands7, 30.0f,
AudioDeviceInfo.TYPE_USB_DEVICE, AudioDeviceInfo.TYPE_BUILTIN_SPEAKER,
Expand All @@ -128,6 +137,7 @@ private void setupDualPresets() {
bandsUnprocessed.add(new FrequencyBandSpec.BandThreshold(10.0f, 10.0f, -10.0f, -10.0f));
bandsUnprocessed.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -30.0f, -30.0f));
mPresets.add(new FrequencyPreset("Unprocessed",
R.string.test_dual_frequency_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_UNPROCESSED,
new int[]{30, 100, 7000, 20000}, bandsUnprocessed, 50.0f,
AudioDeviceInfo.TYPE_UNKNOWN, AudioDeviceInfo.TYPE_USB_DEVICE));
Expand All @@ -137,16 +147,19 @@ private void setupDualPresets() {
bandsVoiceRec.add(new FrequencyBandSpec.BandThreshold(6.0f, 6.0f, -6.0f, -6.0f));
bandsVoiceRec.add(new FrequencyBandSpec.BandThreshold(30.0f, 30.0f, -30.0f, -30.0f));
mPresets.add(new FrequencyPreset("Voice Recognition",
R.string.test_dual_frequency_instructions,
R.string.source_white_noise, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{30, 100, 4000, 20000}, bandsVoiceRec, 50.0f,
AudioDeviceInfo.TYPE_UNKNOWN, AudioDeviceInfo.TYPE_USB_DEVICE));

mPresets.add(new FrequencyPreset("Silence Unprocessed",
R.string.test_dual_frequency_silent_instructions,
R.string.source_silence, StreamConfiguration.INPUT_PRESET_UNPROCESSED,
new int[]{30, 100, 7000, 20000}, bandsUnprocessed, 50.0f,
AudioDeviceInfo.TYPE_UNKNOWN, AudioDeviceInfo.TYPE_UNKNOWN));

mPresets.add(new FrequencyPreset("Silence Voice Recognition",
R.string.test_dual_frequency_silent_instructions,
R.string.source_silence, StreamConfiguration.INPUT_PRESET_VOICE_RECOGNITION,
new int[]{30, 100, 4000, 20000}, bandsVoiceRec, 50.0f,
AudioDeviceInfo.TYPE_UNKNOWN, AudioDeviceInfo.TYPE_UNKNOWN));
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,16 @@
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" >

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/common_instruction_title"/>
<TextView
android:id="@+id/test_dual_frequency_instructions"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/test_dual_frequency_instructions"/>
<!-- Device Set 1 -->
<LinearLayout
android:layout_width="match_parent"
Expand Down
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@
android:orientation="vertical"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin" >
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textStyle="bold"
android:text="@string/common_instruction_title"/>
<TextView
android:id="@+id/test_frequency_instructions"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/test_frequency_default_instructions"/>

<LinearLayout
android:layout_width="match_parent"
Expand Down Expand Up @@ -68,24 +78,6 @@
android:onClick="onShareFile"
android:text="@string/share" />
</LinearLayout>

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/textVolumeSlider"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Volume(dB): 0.0" />

<SeekBar
android:id="@+id/faderVolumeSlider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="500"
android:progress="500" />
</LinearLayout>

<com.mobileer.oboetester.VolumeControlView
android:layout_width="match_parent"
Expand Down
52 changes: 51 additions & 1 deletion apps/OboeTester/app/src/main/res/values/strings.xml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,57 @@
<string name="skipTest">Skip</string>
<string name="test_datapath_instructions">Attach peripherals\nVolume up, [START]</string>
<string name="test_disconnect_instructions">Disconnect all headsets.\nPress [RUN]</string>

<string name="test_dual_frequency_instructions">
Connect a USB audio interface supporting both mic and speaker.<br/>
Place the mic next to the built-in mic, and the speaker 40 cm away.<br/>
Set the speaker volume to high level, then run tests 1 and 2.
</string>
<string name="test_dual_frequency_silent_instructions">
Connect a USB audio interface supporting mic. Connect the external speaker <br/>
to an auxiliary phone. Place the mic next to the built-in mic of device <br/>
under test and the speaker 40 cm away. Set the speaker volume to high level. <br/>
Play the white noise from the auxiliary phone then run tests 1 and 2.
</string>
<string name="test_frequency_background_instructions">
Run the test in a quiet, sound-isolated room.
</string>
<string name="test_frequency_loopback_dongle_instructions">
<![CDATA[Connect <a href="https://source.android.com/docs/core/audio/latency/loopback">loopback dongle</a>
via USB-C to 3.5 mm adapter, then run the test.]]>
</string>
<string name="test_frequency_external_speaker_instructions">
Connect a USB speaker and place it 40 cm away from the device under test.<br/>
Set the speaker volume to high level, then run the test.
</string>
<string name="test_frequency_unprocessed_tone_instructions">
@string/test_frequency_external_speaker_instructions
</string>
<string name="test_frequency_voice_recognition_tone_instructions">
@string/test_frequency_external_speaker_instructions
</string>
<string name="test_frequency_builtin_mic_and_external_speaker_instructions">
@string/test_frequency_external_speaker_instructions
</string>
<string name="test_frequency_external_mic_and_external_speaker_instructions">
Connect a USB audio interface supporting both mic and speaker.<br/>
Place the mic next to the built-in mic, and the speaker 40 cm away.<br/>
Set the speaker volume to high level, then run the test.
</string>
<string name="test_frequency_external_mic_instructions">
Connect a USB mic and place it 20 cm away from the device, then run the test.
</string>
<string name="test_frequency_external_mic_and_left_builtin_speaker_instructions">
@string/test_frequency_external_mic_instructions
</string>
<string name="test_frequency_external_mic_and_right_builtin_speaker_instructions">
@string/test_frequency_external_mic_instructions
</string>
<string name="test_frequency_default_instructions">
Select a preset or configure manually, then start the test.
</string>
<string name="common_instruction_title">
Instructions
</string>
<string name="analyze">Analyze</string>

<string name="routing_crash_intro">
Expand Down
Loading

Back | FazBrowse Home | New Git URL