Oboe
A library for creating real-time audio apps on Android
Loading...
Searching...
No Matches
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
22namespace oboe {
23
24class AudioStream;
25
35public:
36 virtual ~AudioStreamDataCallback() = default;
37
85 virtual DataCallbackResult onAudioReady(
87 void *audioData,
88 int32_t numFrames) = 0;
89};
90
103public:
104 virtual ~AudioStreamErrorCallback() = default;
105
132 virtual bool onError(AudioStream* /* audioStream */, Result /* error */) {
133 return false;
134 }
135
152 virtual void onErrorBeforeClose(AudioStream* /* audioStream */, Result /* error */) {}
153
168 virtual void onErrorAfterClose(AudioStream* /* audioStream */, Result /* error */) {}
169
170};
171
188public:
189 virtual ~AudioStreamCallback() = default;
190};
191
192} // namespace oboe
193
194#endif //OBOE_STREAM_CALLBACK_H
Definition AudioStreamCallback.h:187
Definition AudioStreamCallback.h:34
virtual DataCallbackResult onAudioReady(AudioStream *audioStream, void *audioData, int32_t numFrames)=0
Definition AudioStreamCallback.h:102
virtual void onErrorBeforeClose(AudioStream *, Result)
Definition AudioStreamCallback.h:152
virtual bool onError(AudioStream *, Result)
Definition AudioStreamCallback.h:132
virtual void onErrorAfterClose(AudioStream *, Result)
Definition AudioStreamCallback.h:168
Definition AudioStream.h:42
Definition ResultWithValue.h:47