arduino-audio-tools
AnalogDriverArduino.h
1 #pragma once
2 
3 #include "AudioConfig.h"
4 #if defined(USE_ANALOG_ARDUINO) || defined(DOXYGEN)
5 
6 #include <limits.h> // for INT_MIN and INT_MAX
7 #include "AudioTools/CoreAudio/AudioAnalog/AnalogAudioArduino.h"
8 #include "AudioTools/CoreAudio/AudioTimer/AudioTimer.h"
9 #include "AudioTools/CoreAudio/AudioStreams.h"
10 #include "AudioTools/CoreAudio/AudioTypes.h"
11 #include "AudioTools/CoreAudio/Buffers.h"
12 
13 namespace audio_tools {
14 
24  public:
25  AnalogDriverArduino() = default;
26 
27  bool begin(AnalogConfig cfg) { return drv.begin(cfg); }
28 
29  void end() override { drv.end(); }
30 
31  int available() override { return drv.available(); };
32 
34  size_t readBytes(uint8_t *data, size_t len) override {
35  return drv.write(data, len);
36  }
37 
38  int availableForWrite() override { return drv.availableForWrite(); }
39 
40  size_t write(const uint8_t *data, size_t len) override {
41  return drv.write(data, len);
42  }
43 
44  protected:
45  AnalogAudioArduino drv;
46 };
47 
49 
50 } // namespace audio_tools
51 
52 #endif
bool begin() override
Reopen with last config.
Definition: AnalogAudioArduino.h:46
ESP32 specific configuration for i2s input via adc. The default input pin is GPIO34....
Definition: AnalogConfigESP32.h:21
Please use the AnalogAudioStream: Reading Analog Data using a timer and the Arduino analogRead() meth...
Definition: AnalogDriverArduino.h:23
size_t readBytes(uint8_t *data, size_t len) override
Provides the sampled audio data.
Definition: AnalogDriverArduino.h:34
Definition: AnalogDriverBase.h:13
Generic Implementation of sound input and output for desktop environments using portaudio.
Definition: AudioConfig.h:868