|
arduino-audio-tools
|
A simple class which implements a automatic looping file. In order to support different file implementation the file class is a template parameter. The number of loops can be defined by calling setLoopCount(). You can also optinally limit the total looping file size by calling setSize();. More...
#include <FileLoop.h>
Public Member Functions | |
| FileLoopT ()=default | |
| FileLoopT (FileType file, int count=-1, int rewindPos=-1, int startPos=0) | |
| int | available () override |
| virtual int | availableForWrite () override |
| bool | begin () |
| void | end () |
| FileType & | file () |
| Returns the file. | |
| virtual void | flush () override |
| bool | isLoopActive () |
| operator bool () | |
| size_t | readBytes (uint8_t *data, size_t len) override |
| void | setCallback (void(*cb)(FileLoopT &loop)) |
| You can be notified about a rewind. | |
| void | setFile (FileType file) |
| defines the file that is used for looping | |
| void | setLoopCount (int count) |
| void | setRewindPos (int pos) |
| defines the start position after the rewind. E.g. for wav files this should be 44 | |
| void | setSize (size_t len) |
| optionally defines the requested playing size in bytes | |
| void | setStartPos (int pos) |
| defines the start position at the beginning | |
| void | setWriteBufferSize (int size) |
| size_t | size () |
| Returns the (requested) file size. | |
| size_t | write (const uint8_t *data, size_t len) |
| virtual size_t | write (uint8_t ch) override |
Protected Member Functions | |
| void | refillReadBuffer () |
| Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read() | |
Protected Attributes | |
| int | _timeout = 10 |
| void(* | callback )(FileLoopT &loop) = nullptr |
| FileType | current_file |
| int | loop_count = -1 |
| int | rewind_pos = -1 |
| int | size_open = -1 |
| int | start_pos = 0 |
| RingBuffer< uint8_t > | tmp_in {0} |
| RingBuffer< uint8_t > | tmp_out {0} |
| int | total_size = -1 |
| int | write_buffer_size = MAX_SINGLE_CHARS |
A simple class which implements a automatic looping file. In order to support different file implementation the file class is a template parameter. The number of loops can be defined by calling setLoopCount(). You can also optinally limit the total looping file size by calling setSize();.
|
default |
|
inline |
|
inlineoverridevirtual |
Reimplemented from BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in AudioLoRa, UDPStream, VBANStream, AudioStreamWrapper, ConverterStream< T >, EncodedAudioStream, FaustStream< DSP >, I2SCodecStream, MiniAudioStream, StdioStream, A2DPStream, ESPNowStream, HammingFEC< bytecount, block_t >, AbstractURLStream, URLStreamESP32, NRF24Stream, ReedSolomonFEC< bytecount, additional_bytes >, SPIAudioSlave, USBAudioDeviceBase, AnalogAudioStream, AudioEffectStreamT< T >, AudioEffectStream, Equalizer3Bands, Equalizer3BandsPerChannel, I2SStream, ReformatBaseStream, TimedStream, MemoryStream, RingBufferStream, MeasuringStream, ProgressStream, Throttle, FilteredStream< T, TF >, FilteredStream< int16_t, int16_t >, ChannelFormatConverterStreamT< T >, ChannelFormatConverterStream, NumberFormatConverterStreamT< TFrom, TTo >, NumberFormatConverterStream, QueueStream< T >, QueueStream< uint8_t >, DynamicMemoryStream, FadeStream, FrequencyDetectorAutoCorrelation, FrequencyDetectorZeroCrossing, Pipeline, QualityAnalysisStream, VolumeStream, AudioFFTBase, AudioBLEClient, AudioBLEClient, AudioBLEServer, and AudioBLEServer.
|
inlinevirtual |
Reimplemented from BaseStream.
|
inlinevirtual |
Reimplemented from BaseStream.
|
inline |
Returns the file.
|
inlineoverridevirtualinherited |
Reimplemented from Print.
Reimplemented in PureDataStream, URLStreamBufferedT< T >, URLStreamBufferedT< ICYStream >, ReformatBaseStream, AudioStreamWrapper, ResampleStream, EncodedAudioStream, URLStream, BufferedTaskStream, I2SStream, MemoryStream, RingBufferStream, GeneratedSoundStream< T >, GeneratedSoundStream< int16_t >, and BufferedStream.
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements BaseStream.
|
inlineprotectedinherited |
Refill small read buffer (e.g. 8 bytes) to avoid single byte reads when calling read()
You can be notified about a rewind.
|
inline |
defines the file that is used for looping
|
inline |
count values: 0) do not loop, 1) loop once, n) loop n times, -1) loop endless
|
inline |
defines the start position after the rewind. E.g. for wav files this should be 44
|
inline |
optionally defines the requested playing size in bytes
|
inline |
defines the start position at the beginning
|
inlineinherited |
|
inline |
Returns the (requested) file size.
|
inlinevirtual |
Implements BaseStream.
|
inlineoverridevirtualinherited |
Reimplemented in MemoryStream, AudioStreamWrapper, BufferedTaskStream, RingBufferStream, BufferedStream, and URLStream.
|
protectedinherited |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protectedinherited |
|
protectedinherited |
|
protected |
|
protectedinherited |