diff options
author | Xin Li <delphij@google.com> | 2019-07-01 20:59:30 +0000 |
---|---|---|
committer | Xin Li <delphij@google.com> | 2019-07-01 20:59:30 +0000 |
commit | 86227f6c1b07c2594485ec71a73bc419bcf3f496 (patch) | |
tree | 3e4059b0fcf350b58a95cb23e1d4adda48064468 /LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h | |
parent | 1debe26835ae5c83678927ca363eed334931f901 (diff) | |
parent | 8f0f838b123a0e6cd05b1db06f20d1e50d8389c8 (diff) | |
download | drrickorang-86227f6c1b07c2594485ec71a73bc419bcf3f496.tar.gz |
DO NOT MERGE - Merge qt-dev-plus-aosp-without-vendor (5699924) into stage-aosp-mastertemp_140451723
Bug: 134405016
Change-Id: I126b72b98840607fac4ad9d4a1434483399bed01
Diffstat (limited to 'LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h')
-rw-r--r-- | LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h b/LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h new file mode 100644 index 0000000..d6fb902 --- /dev/null +++ b/LoopbackApp/app/src/main/cpp/lb2/sound_system_aaudio.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef LB2_SOUND_SYSTEM_AAUDIO_H_ +#define LB2_SOUND_SYSTEM_AAUDIO_H_ + +#include <memory> + +#include "lb2/sound_system.h" +#include "lb2/test_context.h" + +// Implementation of a sound system via AAudio API. +class SoundSystemAAudio : public SoundSystem { + public: + // Default constructor--for probing. + SoundSystemAAudio(); + // Constructor with a test context--for testing. + explicit SoundSystemAAudio(const TestContext *testCtx); + SoundSystemAAudio(const SoundSystemAAudio&) = delete; + SoundSystemAAudio& operator=(const SoundSystemAAudio&) = delete; + virtual ~SoundSystemAAudio(); + + bool probeDefaultSettings(PerformanceMode performanceMode, int *samplingRate, + int *playerBufferFrameCount, int *recorderBufferFrameCount) override; + bool init(WriteCallback callback) override; + bool drainInput() override; + ssize_t readAudio(AudioBufferView<sample_t> buffer) override; + void shutdown() override; + + private: + struct Impl; // AAudio-specific details. + + const TestContext* mTestCtx; + const std::unique_ptr<Impl> mImpl; +}; + +#endif // LB2_SOUND_SYSTEM_AAUDIO_H_ |