OboeTester: Test multiple input and output streams#2375
OboeTester: Test multiple input and output streams#2375
Conversation
| import android.widget.Button; | ||
| import java.io.IOException; | ||
|
|
||
| public class TestMultiStreamActivity extends TestAudioActivity { |
| <TextView | ||
| android:layout_width="wrap_content" | ||
| android:layout_height="wrap_content" | ||
| android:text="Multi-Stream (2 Out, 2 In)" |
There was a problem hiding this comment.
Is it possible to allow selecting numbers of streams? And is it possible to have the different numbers of output and input stream.
|
|
||
| if (audioStream->getDirection() == oboe::Direction::Output) { | ||
| int channelCount = audioStream->getChannelCount(); | ||
| float phaseIncrement = 440.0f * M_PI * 2 / (float)audioStream->getSampleRate(); |
There was a problem hiding this comment.
Q: we don't have any common code of generating sine wave?
| for (int i = 0; i < 8; i++) mPeakLevels[i] = 0.0; | ||
| } | ||
|
|
||
| oboe::DataCallbackResult onAudioReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames) override { |
There was a problem hiding this comment.
I think it is always not preferred to have tons of logic in header file.
|
|
||
| oboe::DataCallbackResult onAudioReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames) override { | ||
| int channelCount = audioStream->getChannelCount(); | ||
| if (channelCount > 8) channelCount = 8; |
There was a problem hiding this comment.
Why limit the count to 8? If it is limited, it needs to be aware of from the UI.
| double mPeakLevels[8]; | ||
| }; | ||
|
|
||
| ActivityTestMultiStream() = default; |
|
|
||
| ActivityTestMultiStream() = default; | ||
|
|
||
| virtual ~ActivityTestMultiStream() = default; |
| protected void findAudioCommon() { | ||
| // Initialize this so TestAudioActivity doesn't crash in setConfigViewsEnabled | ||
| mStreamContexts = new java.util.ArrayList<>(); | ||
| // Do not call super.findAudioCommon() so TestAudioActivity doesn't hijack the first stream's buttons! |
There was a problem hiding this comment.
Will this cause problem given mStreamSniffer is initialized in findAudioCommon and there are some places in TestAudioActivity use the value without checking if it is null or not.
| @Override | ||
| protected void resetConfiguration() { | ||
| super.resetConfiguration(); | ||
| mOut1.tester.reset(); |
There was a problem hiding this comment.
Looks like all of these streams can be leaked if closed button is not clicked.
Fixes #1845
This PR adds a new activity with 2 input streams and 2 output streams for testing