|
arduino-audio-tools
|
Typed Stream Copy which supports the conversion from channel to 2 channels. We make sure that we allways copy full samples. More...
#include <StreamCopy.h>
Public Member Functions | |
| StreamCopyT (Allocator &allocator, int bufferSize=DEFAULT_BUFFER_SIZE) | |
| StreamCopyT (int bufferSize=DEFAULT_BUFFER_SIZE, Allocator &allocator=DefaultAllocator) | |
| StreamCopyT (Print &to, AudioStream &from, int bufferSize=DEFAULT_BUFFER_SIZE, Allocator &allocator=DefaultAllocator) | |
| StreamCopyT (Print &to, Stream &from, int bufferSize=DEFAULT_BUFFER_SIZE, Allocator &allocator=DefaultAllocator) | |
| ~StreamCopyT () | |
| 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 () |
| size_t | copy (BaseConverter &converter) |
| size_t | copyAll (int retryCount=5, int retryWaitMs=200) |
| copies all data - returns the number of processed bytes | |
| size_t | copyBytes (size_t bytes) |
| size_t | copyMs (size_t millis, AudioInfo info) |
| size_t | copyN (size_t pages) |
| Copies pages * buffersize samples: returns the processed number of bytes. | |
| void | end () |
| Ends the processing. | |
| Stream * | getFrom () |
| Print * | getTo () |
| bool | isActive () |
| Check if copier is active. | |
| bool | isCheckAvailable () |
| Is Available check activated ? | |
| bool | isCheckAvailableForWrite () |
| Is Available for Write check activated ? | |
| 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) |
| 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 | setMimeDetector (MimeDetector &mime) |
| Define a mime detector. | |
| void | setMinCopySize (int size) |
| 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) |
Protected Member Functions | |
| void | syncAudioInfo () |
| size_t | write (size_t len, size_t &delayCount) |
| blocking write - until everything is processed | |
Protected Attributes | |
| Allocator | _allocator |
| bool | active = true |
| int(* | availableCallback )(Stream *stream) = nullptr |
| Vector< uint8_t > | buffer {0, _allocator} |
| int | buffer_size = DEFAULT_BUFFER_SIZE |
| int | channels = 0 |
| bool | check_available = true |
| bool | check_available_for_write = false |
| int | delay_on_no_data = COPY_DELAY_ON_NODATA |
| Stream * | from = nullptr |
| AudioStream * | from_audio = nullptr |
| bool | is_sync_audio_info = false |
| const char * | log_name = "" |
| int | min_copy_size = 1 |
| void(* | onWrite )(void *obj, void *buffer, size_t len) = nullptr |
| void * | onWriteObj = nullptr |
| AudioInfoSupport * | p_audio_info_support = nullptr |
| BaseConverter * | p_converter = nullptr |
| MimeDetector * | p_mime_detector = nullptr |
| int | retry_delay = 10 |
| int | retryLimit = COPY_RETRY_LIMIT |
| Print * | to = nullptr |
Typed Stream Copy which supports the conversion from channel to 2 channels. We make sure that we allways copy full samples.
| T |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
assign a new output and input stream
assign a new output and input stream
copies the data from the source to the destination and returns the processed number of bytes
|
inline |
copies the data from the source to the destination and applies the converter - the result is the processed number of bytes
copies all data - returns the number of processed bytes
copies the inicated number of bytes from the source to the destination and returns the processed number of bytes
Copies audio for the indicated number of milliseconds: note that the resolution is determined by the buffer_size
Copies pages * buffersize samples: returns the processed number of bytes.
Provides a pointer to the copy source. Can be used to check if the source is defined.
Provides a pointer to the copy target. Can be used to check if the target is defined.
Is Available for Write check activated ?
Defines a callback that provides the available bytes at the source.
Defines a callback that is notified with the wirtten data.
Activates the check that we copy only if available returns a value.
Activates the check that we copy only if available for write returns a value
Defines the dealy that is used if no data is available.
Defines a name which will be printed in the log to identify the copier.
|
inline |
Define a mime detector.
Defines the minimum frame size that is used to round the copy size: 0 will automatically try to determine the value
Defines the delay that is added before we retry an incomplete copy.
Activate the synchronization from the AudioInfo form the source to the target
blocking write - until everything is processed
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |