BackgroundAudio 1.3.3
Loading...
Searching...
No Matches
WrappedAudioOutputBase.h
1/*
2 BackgroundAudio
3 Plays an audio file using IRQ driven decompression. Main loop() writes
4 data to the buffer but isn't blocked while playing
5
6 Copyright (c) 2025 Earle F. Philhower, III <earlephilhower@yahoo.com>
7
8 This program is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#pragma once
23
24#ifdef ESP32
25
26#include <Print.h>
27
31class AudioOutputBase : public Print {
32public:
33 virtual ~AudioOutputBase() { }
34 virtual bool setBuffers(size_t buffers, size_t bufferWords, int32_t silenceSample = 0) = 0;
35 virtual bool setBitsPerSample(int bps) = 0;
36 virtual bool setFrequency(int freq) = 0;
37 virtual bool setStereo(bool stereo = true) = 0;
38 virtual bool begin() = 0;
39 virtual bool end() = 0;
40 virtual bool getUnderflow() = 0;
41 virtual void onTransmit(void(*)(void *), void *) = 0;
42 // From Print
43 virtual size_t write(const uint8_t *buffer, size_t size) = 0;
44 virtual int availableForWrite() = 0;
45};
46
47#else
48
49#include <AudioOutputBase.h>
50
51#endif