Oboe 1.5 A library for creating real-time audio apps on Android

AudioStreamCallback.h
1 /*
2 * Copyright (C) 2016 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 OBOE_STREAM_CALLBACK_H
18 #define OBOE_STREAM_CALLBACK_H
19
20 #include "oboe/Definitions.h"
21
22 namespace oboe {
23
24 class AudioStream;
25
34 class AudioStreamDataCallback {
35 public:
36 virtual ~AudioStreamDataCallback() = default;
37
84 virtual DataCallbackResult onAudioReady(
85 AudioStream *audioStream,
86 void *audioData,
87 int32_t numFrames) = 0;
88 };
89
97 class AudioStreamErrorCallback {
98 public:
99 virtual ~AudioStreamErrorCallback() = default;
100
127 virtual bool onError(AudioStream* /* audioStream */, Result /* error */) {
128 return false;
129 }
130
147 virtual void onErrorBeforeClose(AudioStream* /* audioStream */, Result /* error */) {}
148
163 virtual void onErrorAfterClose(AudioStream* /* audioStream */, Result /* error */) {}
164
165 };
166
181 class AudioStreamCallback : public AudioStreamDataCallback,
182 public AudioStreamErrorCallback {
183 public:
184 virtual ~AudioStreamCallback() = default;
185 };
186
187 } // namespace oboe
188
189 #endif //OBOE_STREAM_CALLBACK_H
oboe::AudioStreamErrorCallback::onError
virtual bool onError(AudioStream *, Result)
Definition: AudioStreamCallback.h:127
oboe::AudioStreamDataCallback
Definition: AudioStreamCallback.h:34
oboe::AudioStreamCallback
Definition: AudioStreamCallback.h:181
oboe::DataCallbackResult
DataCallbackResult
Definition: Definitions.h:119
oboe::AudioStreamErrorCallback::onErrorAfterClose
virtual void onErrorAfterClose(AudioStream *, Result)
Definition: AudioStreamCallback.h:163
oboe::AudioStream
Definition: AudioStream.h:44
oboe::AudioStreamErrorCallback
Definition: AudioStreamCallback.h:97
oboe::Result
Result
Definition: Definitions.h:131
oboe
Definition: AudioStream.h:31
oboe::AudioStreamErrorCallback::onErrorBeforeClose
virtual void onErrorBeforeClose(AudioStream *, Result)
Definition: AudioStreamCallback.h:147
oboe::AudioStreamDataCallback::onAudioReady
virtual DataCallbackResult onAudioReady(AudioStream *audioStream, void *audioData, int32_t numFrames)=0