|
wavelength 1.0.0
|
Reader of a bank file and the audio data file beside it. More...
#include <bankfileio.h>
Public Member Functions | |
| BankFileIO (const String &filename, int nIODirection) | |
| Open a bank file for reading or writing. | |
| ~BankFileIO () | |
| Close every file. | |
| bool | operator! () const |
| Report whether the bank file failed to open. | |
| const char * | GetChunkTag (int nChunkType) |
| Report the identifier of a chunk. | |
| void | OpenAudioData (int nBufferSize) |
| Start reading the audio data file. | |
| bool | GetAudioData (std::vector< unsigned char > &audioData, int *pnPosition, int *pnGotData) |
| Poll the reading of the audio data file. | |
| void | FindChunk (int nChunkType) |
| Start looking for a chunk from the start of the bank file. | |
| bool | ReadChunk (std::vector< unsigned char > &data) |
| Continue reading the bank file. | |
| BankFileIO (const String &filename, int ioDirection) | |
| Open a bank file for reading or writing. | |
| ~BankFileIO () | |
| Close every file. | |
| bool | operator! () const |
| Report whether the bank file failed to open. | |
| void | PackChunkHeader (const char *header, std::vector< unsigned char > &data) |
| Copy a chunk header into eight bytes. | |
| void | UnpackChunkHeader (char *header, std::vector< unsigned char > &data) |
| Copy eight bytes into a chunk header. | |
| void | BeginAudioDataOutput () |
| Create the audio data file for writing. | |
| void | WriteAudioData (std::vector< unsigned char > &data) |
| Append bytes to the audio data file. | |
| void | EndAudioDataOutput () |
| Close the audio data file. | |
| BinStream * | BeginChunk (int chunkType) |
| Start writing a chunk. | |
| const char * | GetChunkTag (int chunkType) |
| Report the identifier of a chunk. | |
| void | EndChunk (BinStream *stream) |
| Complete the header of the chunk BeginChunk() started. | |
| void | OpenAudioData (int bufferSize) |
| Start reading the audio data file. | |
| bool | GetAudioData (std::vector< unsigned char > &oAudioData, int *position, bool *gotData) |
| Poll the reading of the audio data file. | |
| void | FindChunk (int chunkType) |
| Start looking for a chunk from the start of the bank file. | |
| bool | ReadChunk (std::vector< unsigned char > &data) |
| Continue reading the bank file. | |
Static Public Member Functions | |
| static String | AudioDataFilename (const String &bankFileName) |
| Derive the path of the audio data file from the path of a bank file. | |
| static String | AudioDataFilename (const String &iBankFileName) |
| Derive the path of the audio data file from the path of a bank file. | |
Reader of a bank file and the audio data file beside it.
Reader and writer of a bank file and the audio data file beside it.
The class has no RTTI, and its name comes from the synthesiser editor that shares the source. The object is 0x44 bytes. A bank file is a run of chunks, each an identifier of four characters, a size word, and the data. The reader finds a chunk with asynchronous reads that the caller polls. The writer's routines are absent from the game.
The class has no RTTI, and its name comes from its source file. The object is 0x44 bytes. A bank file is a run of chunks, each an identifier of four characters, a size word, and the data. The writer produces chunks through a FileStream. The reader finds a chunk with asynchronous reads that the caller polls.
Directions of a BankFileIO.
| Enumerator | |
|---|---|
| kRead | Read an existing bank. |
| kWrite | Write a bank. |
| kRead | Read an existing bank. |
| kWrite | Write a bank. |
Chunks of a bank file.
Directions of a BankFileIO.
| Enumerator | |
|---|---|
| kRead | Read an existing bank. |
| kWrite | Write a bank. |
| kRead | Read an existing bank. |
| kWrite | Write a bank. |
Chunks of a bank file.
| BankFileIO::BankFileIO | ( | const String & | filename, |
| int | nIODirection ) |
Open a bank file for reading or writing.
| filename | The path of the bank file. |
| nIODirection | The direction, an IODirection. |
| BankFileIO::~BankFileIO | ( | ) |
Close every file.
| BankFileIO::BankFileIO | ( | const String & | filename, |
| int | ioDirection ) |
Open a bank file for reading or writing.
| filename | The path of the bank file. |
| ioDirection | The direction, an IODirection. |
| BankFileIO::~BankFileIO | ( | ) |
Close every file.
| bool BankFileIO::operator! | ( | ) | const |
Report whether the bank file failed to open.
Derive the path of the audio data file from the path of a bank file.
| bankFileName | The path of the bank file. |
| const char * BankFileIO::GetChunkTag | ( | int | nChunkType | ) |
Report the identifier of a chunk.
| nChunkType | The chunk, a ChunkType. |
| void BankFileIO::OpenAudioData | ( | int | nBufferSize | ) |
Start reading the audio data file.
| nBufferSize | The size of each read buffer in bytes. |
| bool BankFileIO::GetAudioData | ( | std::vector< unsigned char > & | audioData, |
| int * | pnPosition, | ||
| int * | pnGotData ) |
Poll the reading of the audio data file.
| audioData | Receives the data of a completed read, padded with zeros to a multiple of 64 bytes. |
| pnPosition | Receives the offset of the data in the file. |
| pnGotData | Receives 1 when a read completed, otherwise 0. |
| void BankFileIO::FindChunk | ( | int | nChunkType | ) |
Start looking for a chunk from the start of the bank file.
| nChunkType | The chunk, a ChunkType. |
| bool BankFileIO::ReadChunk | ( | std::vector< unsigned char > & | data | ) |
Continue reading the bank file.
Call it until it returns false.
| data | Receives the data of the chunk FindChunk() requested. |
| bool BankFileIO::operator! | ( | ) | const |
Report whether the bank file failed to open.
| void BankFileIO::PackChunkHeader | ( | const char * | header, |
| std::vector< unsigned char > & | data ) |
Copy a chunk header into eight bytes.
No routine calls it.
| header | The header, the identifier and then the size word. |
| data | Receives the bytes. |
| void BankFileIO::UnpackChunkHeader | ( | char * | header, |
| std::vector< unsigned char > & | data ) |
Copy eight bytes into a chunk header.
No routine calls it.
| header | Receives the identifier and then the size word. |
| data | The bytes. |
Derive the path of the audio data file from the path of a bank file.
| iBankFileName | The path of the bank file. |
| void BankFileIO::BeginAudioDataOutput | ( | ) |
Create the audio data file for writing.
| void BankFileIO::WriteAudioData | ( | std::vector< unsigned char > & | data | ) |
Append bytes to the audio data file.
| data | The bytes. |
| void BankFileIO::EndAudioDataOutput | ( | ) |
Close the audio data file.
| BinStream * BankFileIO::BeginChunk | ( | int | chunkType | ) |
Start writing a chunk.
EndChunk() completes its header.
| chunkType | The chunk, a ChunkType. |
| const char * BankFileIO::GetChunkTag | ( | int | chunkType | ) |
Report the identifier of a chunk.
| chunkType | The chunk, a ChunkType. |
| void BankFileIO::EndChunk | ( | BinStream * | stream | ) |
Complete the header of the chunk BeginChunk() started.
| stream | The stream BeginChunk() returned. |
| void BankFileIO::OpenAudioData | ( | int | bufferSize | ) |
Start reading the audio data file.
No routine calls it.
| bufferSize | The size of each read buffer in bytes. |
| bool BankFileIO::GetAudioData | ( | std::vector< unsigned char > & | oAudioData, |
| int * | position, | ||
| bool * | gotData ) |
Poll the reading of the audio data file.
No routine calls it.
| oAudioData | Receives the data of a completed read, padded with zeros to a multiple of 64 bytes. The capacity must already fit it. |
| position | Receives the offset of the data in the file. |
| gotData | Receives whether a read completed. |
| void BankFileIO::FindChunk | ( | int | chunkType | ) |
Start looking for a chunk from the start of the bank file.
| chunkType | The chunk, a ChunkType. |
| bool BankFileIO::ReadChunk | ( | std::vector< unsigned char > & | data | ) |
Continue reading the bank file.
Call it until it returns false.
| data | Receives the data of the chunk FindChunk() requested. |