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

Typed Stream Copy which supports the conversion from channel to 2 channels. We make sure that we allways copy full samples. More...

#include <AudioCopy.h>

Public Member Functions

 StreamCopyT (int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopyT (Print &to, AudioStream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopyT (Print &to, Stream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopyT (StreamCopyT const &)=delete
 
int available ()
 available bytes in the data source
 
void begin ()
 
void begin (Print &to, AudioStream &from)
 
void begin (Print &to, Stream &from)
 
int bufferSize ()
 Provides the buffer size.
 
size_t copy ()
 
size_t copyAll (int retryCount=5, int retryWaitMs=200)
 copies all data - returns true if we copied anything
 
size_t copyN (size_t pages)
 Copies pages * buffersize samples.
 
void end ()
 
StreamgetFrom ()
 
PrintgetTo ()
 
bool isCheckAvailableForWrite ()
 Is Available for Write check activated ?
 
const char * mime ()
 Provides the actual mime type, that was determined from the first available data.
 
StreamCopyToperator= (StreamCopyT const &)=delete
 
void resize (int len)
 resizes the copy buffer
 
void setAvailableCallback (int(*callback)(Stream *stream))
 Defines a callback that provides the available bytes at the source.
 
void setCallbackOnWrite (void(*onWrite)(void *obj, void *buffer, size_t len), void *obj)
 Defines a callback that is notified with the wirtten data.
 
void setCheckAvailableForWrite (bool flag)
 Activates the check that we copy only if available for write returns a value.
 
void setDelayOnNoData (int delayMs)
 Defines the dealy that is used if no data is available.
 
void setMimeCallback (void(*callback)(const char *))
 Define the callback that will notify about mime changes.
 
void setRetry (int retry)
 Defines the max number of retries.
 

Protected Member Functions

void notifyMime (void *data, size_t len)
 Update the mime type.
 
size_t write (size_t len, size_t &delayCount)
 

Protected Attributes

const char * actual_mime = nullptr
 
int(* availableCallback )(Stream *stream) =nullptr
 
Vector< uint8_t > buffer {0}
 
int buffer_size
 
bool check_available_for_write = true
 
int delay_on_no_data = COPY_DELAY_ON_NODATA
 
AudioStreamfrom = nullptr
 
bool is_first = false
 
void(* notifyMimeCallback )(const char *mime) = nullptr
 
void(* onWrite )(void *obj, void *buffer, size_t len) = nullptr
 
void * onWriteObj = nullptr
 
int retryLimit = COPY_RETRY_LIMIT
 
Printto = nullptr
 

Detailed Description

template<class T>
class audio_tools::StreamCopyT< T >

Typed Stream Copy which supports the conversion from channel to 2 channels. We make sure that we allways copy full samples.

Template Parameters
T
Author
Phil Schatzmann

The documentation for this class was generated from the following file: