blob: ee12fc1772a05bcca75902cf62d5664f23dff133 [file] [log] [blame]
Phil Burk7386a832019-03-21 16:07:27 -07001/*
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 Burk98b6d1f2019-11-05 16:33:13 -080025#include "analyzer/LatencyAnalyzer.h"
Phil Burk81ca4742019-04-24 07:53:36 -070026#include "MultiChannelRecording.h"
Phil Burk7386a832019-03-21 16:07:27 -070027
28class FullDuplexAnalyzer : public FullDuplexStream {
29public:
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 Burk81ca4742019-04-24 07:53:36 -070051 void setRecording(MultiChannelRecording *recording) {
52 mRecording = recording;
53 }
54
55private:
56 MultiChannelRecording *mRecording = nullptr;
57
Phil Burk7386a832019-03-21 16:07:27 -070058};
59
60
61#endif //OBOETESTER_FULL_DUPLEX_ANALYZER_H
62