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 
35 public:
36  virtual ~AudioStreamDataCallback() = default;
37 
85  AudioStream *audioStream,
86  void *audioData,
87  int32_t numFrames) = 0;
88 };
89 
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 
182  public AudioStreamErrorCallback {
183 public:
184  virtual ~AudioStreamCallback() = default;
185 };
186 
187 } // namespace oboe
188 
189 #endif //OBOE_STREAM_CALLBACK_H
virtual bool onError(AudioStream *, Result)
Definition: AudioStreamCallback.h:127
Definition: AudioStreamCallback.h:34
Definition: AudioStreamCallback.h:181
DataCallbackResult
Definition: Definitions.h:119
virtual void onErrorAfterClose(AudioStream *, Result)
Definition: AudioStreamCallback.h:163
Definition: AudioStream.h:44
Definition: AudioStreamCallback.h:97
Result
Definition: Definitions.h:131
Definition: AudioStream.h:31
virtual void onErrorBeforeClose(AudioStream *, Result)
Definition: AudioStreamCallback.h:147
virtual DataCallbackResult onAudioReady(AudioStream *audioStream, void *audioData, int32_t numFrames)=0