Phil Burk | 7386a83 | 2019-03-21 16:07:27 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #ifndef OBOETESTER_FULL_DUPLEX_ANALYZER_H |
| 18 | #define OBOETESTER_FULL_DUPLEX_ANALYZER_H |
| 19 | |
| 20 | #include <unistd.h> |
| 21 | #include <sys/types.h> |
| 22 | |
| 23 | #include "oboe/Oboe.h" |
| 24 | #include "FullDuplexStream.h" |
Phil Burk | 98b6d1f | 2019-11-05 16:33:13 -0800 | [diff] [blame] | 25 | #include "analyzer/LatencyAnalyzer.h" |
Phil Burk | 81ca474 | 2019-04-24 07:53:36 -0700 | [diff] [blame] | 26 | #include "MultiChannelRecording.h" |
Phil Burk | 7386a83 | 2019-03-21 16:07:27 -0700 | [diff] [blame] | 27 | |
| 28 | class FullDuplexAnalyzer : public FullDuplexStream { |
| 29 | public: |
| 30 | FullDuplexAnalyzer() {} |
| 31 | |
| 32 | /** |
| 33 | * Called when data is available on both streams. |
| 34 | * Caller should override this method. |
| 35 | */ |
| 36 | oboe::DataCallbackResult onBothStreamsReady( |
| 37 | const void *inputData, |
| 38 | int numInputFrames, |
| 39 | void *outputData, |
| 40 | int numOutputFrames |
| 41 | ) override; |
| 42 | |
| 43 | oboe::Result start() override; |
| 44 | |
| 45 | bool isDone() { |
| 46 | return false; |
| 47 | } |
| 48 | |
| 49 | virtual LoopbackProcessor *getLoopbackProcessor() = 0; |
| 50 | |
Phil Burk | 81ca474 | 2019-04-24 07:53:36 -0700 | [diff] [blame] | 51 | void setRecording(MultiChannelRecording *recording) { |
| 52 | mRecording = recording; |
| 53 | } |
| 54 | |
| 55 | private: |
| 56 | MultiChannelRecording *mRecording = nullptr; |
| 57 | |
Phil Burk | 7386a83 | 2019-03-21 16:07:27 -0700 | [diff] [blame] | 58 | }; |
| 59 | |
| 60 | |
| 61 | #endif //OBOETESTER_FULL_DUPLEX_ANALYZER_H |
| 62 | |