aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Burk <philburk@mobileer.com>2022-12-05 13:42:02 -0800
committerGitHub <noreply@github.com>2022-12-05 13:42:02 -0800
commit9867f6942489496a45b47445fde696e5d927b4b5 (patch)
tree7d7667a2cc7b9a9121d63cef376d6a268f8c0dee
parent3ad855135b360697e581239fcf4843db00bb13f7 (diff)
downloadoboe-9867f6942489496a45b47445fde696e5d927b4b5.tar.gz
OboeTester: catch IOExceptions (#1670)
Was crashing if 13 channels selected.
-rw-r--r--apps/OboeTester/app/src/main/java/com/mobileer/oboetester/EchoActivity.java21
-rw-r--r--apps/OboeTester/app/src/main/java/com/mobileer/oboetester/GlitchActivity.java10
-rw-r--r--apps/OboeTester/app/src/main/java/com/mobileer/oboetester/ManualGlitchActivity.java3
-rw-r--r--apps/OboeTester/app/src/main/java/com/mobileer/oboetester/RecorderActivity.java16
4 files changed, 33 insertions, 17 deletions
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/EchoActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/EchoActivity.java
index 4eefc5d9..69fb7617 100644
--- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/EchoActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/EchoActivity.java
@@ -174,21 +174,24 @@ public class EchoActivity extends TestInputActivity {
return ACTIVITY_ECHO;
}
-
@Override
protected void resetConfiguration() {
super.resetConfiguration();
mAudioOutTester.reset();
}
- public void onStartEcho(View view) throws IOException {
- openAudio();
- startAudio();
- setDelayTime(mDelayTime);
- mStartButton.setEnabled(false);
- mStopButton.setEnabled(true);
- keepScreenOn(true);
- mNativeSniffer.startSniffer();
+ public void onStartEcho(View view) {
+ try {
+ openAudio();
+ startAudio();
+ setDelayTime(mDelayTime);
+ mStartButton.setEnabled(false);
+ mStopButton.setEnabled(true);
+ keepScreenOn(true);
+ mNativeSniffer.startSniffer();
+ } catch (IOException e) {
+ showErrorToast(e.getMessage());
+ }
}
public void onStopEcho(View view) {
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/GlitchActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/GlitchActivity.java
index 8df0d98b..ce0182c1 100644
--- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/GlitchActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/GlitchActivity.java
@@ -309,7 +309,15 @@ public class GlitchActivity extends AnalyzerActivity {
}
// Called on UI thread
- public void onStartAudioTest(View view) throws IOException {
+ public void onStartAudioTest(View view) {
+ try {
+ openStartAudioTestUI();
+ } catch (IOException e) {
+ showErrorToast(e.getMessage());
+ }
+ }
+
+ protected void openStartAudioTestUI() throws IOException {
openAudio();
startAudioTest();
mStartButton.setEnabled(false);
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/ManualGlitchActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/ManualGlitchActivity.java
index 4e785193..699344df 100644
--- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/ManualGlitchActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/ManualGlitchActivity.java
@@ -123,7 +123,7 @@ public class ManualGlitchActivity extends GlitchActivity {
int numBursts = mBundleFromIntent.getInt(KEY_BUFFER_BURSTS, VALUE_DEFAULT_BUFFER_BURSTS);
try {
- onStartAudioTest(null);
+ openStartAudioTestUI();
int sizeFrames = mAudioOutTester.getCurrentAudioStream().getFramesPerBurst() * numBursts;
mAudioOutTester.getCurrentAudioStream().setBufferSizeInFrames(sizeFrames);
@@ -159,6 +159,7 @@ public class ManualGlitchActivity extends GlitchActivity {
public void onTestFinished() {
super.onTestFinished();
}
+
// Only call from UI thread.
@Override
public void onTestBegan() {
diff --git a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/RecorderActivity.java b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/RecorderActivity.java
index e0dcb0e4..48df2185 100644
--- a/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/RecorderActivity.java
+++ b/apps/OboeTester/app/src/main/java/com/mobileer/oboetester/RecorderActivity.java
@@ -58,12 +58,16 @@ public class RecorderActivity extends TestInputActivity {
return ACTIVITY_RECORD_PLAY;
}
- public void onStartRecording(View view) throws IOException {
- openAudio();
- startAudio();
- mRecorderState = STATE_RECORDING;
- mGotRecording = true;
- updateButtons();
+ public void onStartRecording(View view) {
+ try {
+ openAudio();
+ startAudio();
+ mRecorderState = STATE_RECORDING;
+ mGotRecording = true;
+ updateButtons();
+ } catch (IOException e) {
+ showErrorToast(e.getMessage());
+ }
}
public void onStopRecordPlay(View view) {