arduino-audio-tools
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
StreamCopy Class Reference

We provide the typeless StreamCopy as a subclass of StreamCopyT. More...

#include <StreamCopy.h>

Inheritance diagram for StreamCopy:
StreamCopyT< uint8_t >

Public Member Functions

 StreamCopy (AudioOutput &to, AudioStream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopy (AudioStream &to, AudioStream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopy (int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopy (Print &to, AudioStream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
 StreamCopy (Print &to, Stream &from, int buffer_size=DEFAULT_BUFFER_SIZE)
 
int available ()
 available bytes of the data source
 
void begin ()
 (Re)starts the processing
 
void begin (Print &to, AudioStream &from)
 assign a new output and input stream
 
void begin (Print &to, Stream &from)
 assign a new output and input stream
 
int bufferSize ()
 Provides the buffer size.
 
size_t copy ()
 Copies all bytes from the input to the output.
 
size_t copy (BaseConverter &converter)
 copies a buffer length of data and applies the converter
 
size_t copyAll (int retryCount=5, int retryWaitMs=200)
 copies all data - returns true if we copied anything
 
size_t copyMs (size_t millis, AudioInfo info)
 Copies audio for the indicated number of milliseconds: note that the resolution is determined by the buffer_size.
 
size_t copyN (size_t pages)
 Copies pages * buffersize samples.
 
void end ()
 Ends the processing.
 
StreamgetFrom ()
 Provides a pointer to the copy source. Can be used to check if the source is defined.
 
PrintgetTo ()
 Provides a pointer to the copy target. Can be used to check if the target is defined.
 
bool isActive ()
 Check if copier is active.
 
bool isCheckAvailable ()
 Is Available check activated ?
 
bool isCheckAvailableForWrite ()
 Is Available for Write check activated ?
 
const char * mime ()
 Provides the actual mime type, that was determined from the first available data.
 
int minCopySize ()
 Determine frame size.
 
void resize (int len)
 resizes the copy buffer
 
void setActive (bool flag)
 deactivate/activate copy - active by default
 
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 setCheckAvailable (bool flag)
 Activates the check that we copy only if available returns a value.
 
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 setLogName (const char *name)
 Defines a name which will be printed in the log to identify the copier.
 
void setMimeCallback (void(*callback)(const char *))
 Define the callback that will notify about mime changes.
 
void setMinCopySize (int size)
 Defines the minimum frame size that is used to round the copy size: 0 will automatically try to determine the value.
 
void setRetry (int retry)
 Defines the max number of retries.
 
void setRetryDelay (int delay)
 Defines the delay that is added before we retry an incomplete copy.
 
void setSynchAudioInfo (bool active)
 Activate the synchronization from the AudioInfo form the source to the target.
 

Protected Member Functions

void notifyMime (void *data, size_t len)
 Update the mime type.
 
void syncAudioInfo ()
 
size_t write (size_t len, size_t &delayCount)
 blocking write - until everything is processed
 

Protected Attributes

bool active
 
const char * actual_mime
 
int(* availableCallback )(Stream *stream)
 
Vector< uint8_t > buffer
 
int buffer_size
 
int channels
 
bool check_available
 
bool check_available_for_write
 
int delay_on_no_data
 
AudioStreamfrom
 
bool is_first
 
bool is_sync_audio_info
 
const char * log_name
 
int min_copy_size
 
void(* notifyMimeCallback )(const char *mime)
 
void(* onWrite )(void *obj, void *buffer, size_t len)
 
void * onWriteObj
 
AudioInfoSupportp_audio_info_support
 
int retry_delay
 
int retryLimit
 
Printto
 

Detailed Description

We provide the typeless StreamCopy as a subclass of StreamCopyT.

Author
Phil Schatzmann

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