arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FileLoopT< FileType > Class Template Reference

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>

Inheritance diagram for FileLoopT< FileType >:
BaseStream Stream Print

Public Member Functions

 FileLoopT (FileType file, int count=-1, int rewindPos=-1)
 
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 setSize (size_t len)
 optionally defines the requested playing size in bytes
 
void setStartPos (int pos)
 defines the start position after the rewind. E.g. for wav files this should be 44
 
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 ()
 

Protected Attributes

int _timeout = 10
 
void(* callback )(FileLoopT &loop) = nullptr
 
FileType current_file
 
int loop_count = -1
 
int size_open = -1
 
int start_pos = -1
 
RingBuffer< uint8_t > tmp_in {0}
 
RingBuffer< uint8_t > tmp_out {0}
 
int total_size = -1
 
int write_buffer_size = MAX_SINGLE_CHARS
 

Detailed Description

template<class FileType>
class audio_tools::FileLoopT< FileType >

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();.

Author
Phil Schatzmann

Member Function Documentation

◆ available()

template<class FileType >
int available ( )
inlineoverridevirtual

Reimplemented from BaseStream.

◆ availableForWrite()

virtual int availableForWrite ( )
inlineoverridevirtualinherited

◆ begin()

template<class FileType >
bool begin ( )
inlinevirtual

Reimplemented from BaseStream.

◆ end()

template<class FileType >
void end ( )
inlinevirtual

Reimplemented from BaseStream.

◆ flush()

virtual void flush ( )
inlineoverridevirtualinherited

Reimplemented from Print.

Reimplemented in ResampleStream, BufferedTaskStream, and BufferedStream.

◆ isLoopActive()

template<class FileType >
bool isLoopActive ( )
inline
Returns
true as long as we are looping

◆ readBytes()

template<class FileType >
size_t readBytes ( uint8_t *  data,
size_t  len 
)
inlineoverridevirtual

Implements BaseStream.

◆ setLoopCount()

template<class FileType >
void setLoopCount ( int  count)
inline

count values: 0) do not loop, 1) loop once, n) loop n times, -1) loop endless

◆ write() [1/2]

template<class FileType >
size_t write ( const uint8_t *  data,
size_t  len 
)
inlinevirtual

Implements BaseStream.

◆ write() [2/2]

virtual size_t write ( uint8_t  ch)
inlineoverridevirtualinherited

Reimplemented in BufferedTaskStream, and BufferedStream.


The documentation for this class was generated from the following file:
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy