Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
|
Public Member Functions | |
WriteFile (const char *filename, bool overwrite, bool append) | |
void | setFileType (WriteFileType newFileType) |
void | setEcho (bool newEcho) |
void | setEchoInterval (int newPeriod) |
void | setBufferSize (unsigned int newSize) |
void | setFormat (const char *newFormat) |
void | setHeader (const char *newHeader) |
void | setFooter (const char *newFooter) |
void | log (float value) |
void | log (const float *array, int length) |
void | setup (const char *filename, bool overwrite=false, bool append=false) |
int | getOffset () |
float | getBufferStatus () |
void | cleanup () |
Static Public Member Functions | |
static int | getNumInstances () |
static void | writeAllHeaders () |
static void | writeAllFooters () |
static void | writeAllOutputs (bool flush) |
static void | startThread () |
static void | stopThread () |
static void | run (void *) |
static char * | generateUniqueFilename (const char *original) |
void WriteFile::setFileType | ( | WriteFileType | newFileType | ) |
Set the type of file to write, can be either kText or kBinary. Binary files cAn be imported e.g. in Matlab: fid=fopen('out','r'); A = fread(fid, 'float');
void WriteFile::setEcho | ( | bool | newEcho | ) |
Set whether to echo the logged data to the console (according to the EchoInterval set with setEchoInterval()
void WriteFile::setEchoInterval | ( | int | newPeriod | ) |
Set after how often to log data to the console. The unit of measurement is the number of calls to log().
void WriteFile::setBufferSize | ( | unsigned int | newSize | ) |
Set the size of the internal buffer.
A reasonable default value is chosen automatically. However if your often received a "crossed pointer" error, you may want to use this to increase the size of the buffer manually.
void WriteFile::setFormat | ( | const char * | newFormat | ) |
Set the format that you want to use for your output.
Only f is allowed (with modifiers). When in binary mode, the specified format is used only for echoing to console.
void WriteFile::setHeader | ( | const char * | newHeader | ) |
Set one or more lines to be printed at the beginning of the file.
This is ignored in binary mode.
void WriteFile::setFooter | ( | const char * | newFooter | ) |
Set one or more lines to be printed at the end of the file.
This is ignored in binary mode.
void WriteFile::log | ( | float | value | ) |
Log one value to the file.
void WriteFile::log | ( | const float * | array, |
int | length | ||
) |
Log multiple values to the file.
void WriteFile::setup | ( | const char * | filename, |
bool | overwrite = false , |
||
bool | append = false |
||
) |
Initialize the file to write to. This has to be called before any other method. If overwrite
is false, existing files will not be overwritten and the filename will be automatically incremented.
int WriteFile::getOffset | ( | ) |
Gets the distance between the write and read pointers of the buffer that holds data to be written to disk.
float WriteFile::getBufferStatus | ( | ) |
Inquiries the status of the buffer that holds data to be written to disk.
|
static |
Returns a unique filename by appending a number at the end of the original filename.