xref: /aosp_15_r20/external/oboe/samples/iolib/README.md (revision 05767d913155b055644481607e6fa1e35e2fe72c)
1*05767d91SRobert Wu**iolib**
2*05767d91SRobert Wu==========
3*05767d91SRobert WuClasses for playing audio data.
4*05767d91SRobert Wu
5*05767d91SRobert Wu## Abstract
6*05767d91SRobert Wu(Oboe) **iolib** contains classes implementing streaming audio playback and mixing from multiple sources. It's purpose is to demonstrate best practices and provide reusable code.
7*05767d91SRobert Wu
8*05767d91SRobert Wu Note: the more general name of "iolib" was chosen  since it is presumed that this project will eventually implement audio capture capability.
9*05767d91SRobert Wu
10*05767d91SRobert Wu**iolib** is written in C++ and is intended to be called from Android native code. It is implemented as a static library.
11*05767d91SRobert Wu
12*05767d91SRobert Wu# **iolib** project structure
13*05767d91SRobert Wu* player
14*05767d91SRobert WuContains classes to support streaming playback from (potentially) multiple audio sources.
15*05767d91SRobert Wu
16*05767d91SRobert Wu## player classes
17*05767d91SRobert Wu### DataSource
18*05767d91SRobert WuDeclares the basic interface for audio data sources.
19*05767d91SRobert Wu
20*05767d91SRobert Wu### SampleSource
21*05767d91SRobert WuExtends the `DataSource` interface for audio data coming from SampleBuffer objects.
22*05767d91SRobert Wu
23*05767d91SRobert Wu### OneShotSampleSource
24*05767d91SRobert WuExtends `SampleSource` to provide data that plays through it's `SampleBuffer` and then provides silence, (i.e. a non-looping sample)
25*05767d91SRobert Wu
26*05767d91SRobert Wu### SampleBuffer
27*05767d91SRobert WuLoads and holds (in memory) audio sample data and provides read-only access to that data.
28*05767d91SRobert Wu
29*05767d91SRobert Wu### SimpleMultiPlayer
30*05767d91SRobert WuImplements an Oboe audio stream into which it mixes audio from some number of `SampleSource`s.
31*05767d91SRobert Wu
32*05767d91SRobert WuThis class demonstrates:
33*05767d91SRobert Wu* Creation and lifetime management of an Oboe audio stream (`ManagedStream`)
34*05767d91SRobert Wu* Logic for an Oboe `AudioStreamCallback` interface.
35*05767d91SRobert Wu* Logic for handling streaming restart on error (i.e. playback device changes)
36