Oboe
A library for creating real-time audio apps on Android
Loading...
Searching...
No Matches
FifoControllerBase.h
1/*
2 * Copyright 2015 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 NATIVEOBOE_FIFOCONTROLLERBASE_H
18#define NATIVEOBOE_FIFOCONTROLLERBASE_H
19
20#include <stdint.h>
21
22namespace oboe {
23
35
36public:
42 FifoControllerBase(uint32_t totalFrames);
43
44 virtual ~FifoControllerBase() = default;
45
53 uint32_t getFullFramesAvailable() const;
54
60 uint32_t getReadIndex() const;
61
68 void advanceReadIndex(uint32_t numFrames);
69
75 uint32_t getEmptyFramesAvailable() const;
76
82 uint32_t getWriteIndex() const;
83
90 void advanceWriteIndex(uint32_t numFrames);
91
97 uint32_t getFrameCapacity() const { return mTotalFrames; }
98
99 virtual uint64_t getReadCounter() const = 0;
100 virtual void setReadCounter(uint64_t n) = 0;
101 virtual void incrementReadCounter(uint64_t n) = 0;
102 virtual uint64_t getWriteCounter() const = 0;
103 virtual void setWriteCounter(uint64_t n) = 0;
104 virtual void incrementWriteCounter(uint64_t n) = 0;
105
106private:
107 uint32_t mTotalFrames;
108};
109
110} // namespace oboe
111
112#endif //NATIVEOBOE_FIFOCONTROLLERBASE_H
Definition: FifoControllerBase.h:34
uint32_t getFullFramesAvailable() const
uint32_t getFrameCapacity() const
Definition: FifoControllerBase.h:97
uint32_t getWriteIndex() const
uint32_t getEmptyFramesAvailable() const
void advanceReadIndex(uint32_t numFrames)
FifoControllerBase(uint32_t totalFrames)
void advanceWriteIndex(uint32_t numFrames)
uint32_t getReadIndex() const
Definition: AudioStream.h:31