# Oboe: include/oboe/AudioStreamCallback.h Source File

AudioStreamCallback.h
/*
* Copyright (C) 2016 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 OBOE_STREAM_CALLBACK_H
#define OBOE_STREAM_CALLBACK_H
#include "oboe/Definitions.h"
namespace oboe {
class AudioStream;
class AudioStreamDataCallback {
public:
virtual ~AudioStreamDataCallback() = default;
virtual DataCallbackResult onAudioReady(
AudioStream *audioStream,
void *audioData,
int32_t numFrames) = 0;
};
class AudioStreamErrorCallback {
public:
virtual ~AudioStreamErrorCallback() = default;
virtual bool onError(AudioStream* /* audioStream */, Result /* error */) {
return false;
}
virtual void onErrorBeforeClose(AudioStream* /* audioStream */, Result /* error */) {}
virtual void onErrorAfterClose(AudioStream* /* audioStream */, Result /* error */) {}
};
class AudioStreamCallback : public AudioStreamDataCallback,
public AudioStreamErrorCallback {
public:
virtual ~AudioStreamCallback() = default;
};
} // namespace oboe
#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