174 bool GetAudioData(std::vector<unsigned char> &oAudioData,
int *position,
bool *gotData);
209 bool ReadChunkHeader(std::vector<unsigned char> &data);
215 File *mBankAsyncInputFile;
static const String kBankExtension(".bnk")
Extension of a bank file.
static const String kAudioDataExtension(".nse")
Extension of the audio data file that goes with a bank file.
Reader of a bank file and the audio data file beside it.
Definition bankfileio.h:36
bool GetAudioData(std::vector< unsigned char > &oAudioData, int *position, bool *gotData)
Poll the reading of the audio data file.
BinStream * BeginChunk(int chunkType)
Start writing a chunk.
void EndChunk(BinStream *stream)
Complete the header of the chunk BeginChunk() started.
void EndAudioDataOutput()
Close the audio data file.
void UnpackChunkHeader(char *header, std::vector< unsigned char > &data)
Copy eight bytes into a chunk header.
ChunkType
Chunks of a bank file.
Definition bankfileio.h:45
@ kSampleFilenameChunk
Definition bankfileio.h:50
@ kInstrumentNameChunk
Definition bankfileio.h:52
@ kSampleDescriptionChunk
Definition bankfileio.h:48
@ kBankNameChunk
Definition bankfileio.h:51
@ kSampleChunk
Definition bankfileio.h:49
@ kInstrumentChunk
Definition bankfileio.h:47
@ kSampleDescriptionNameChunk
Definition bankfileio.h:53
@ kBankChunk
Definition bankfileio.h:46
@ kSampleNameChunk
Definition bankfileio.h:54
bool operator!() const
Report whether the bank file failed to open.
IODirection
Directions of a BankFileIO.
Definition bankfileio.h:39
@ kRead
Definition bankfileio.h:40
@ kWrite
Definition bankfileio.h:41
void OpenAudioData(int bufferSize)
Start reading the audio data file.
void WriteAudioData(std::vector< unsigned char > &data)
Append bytes to the audio data file.
void BeginAudioDataOutput()
Create the audio data file for writing.
static String AudioDataFilename(const String &iBankFileName)
Derive the path of the audio data file from the path of a 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.
const char * GetChunkTag(int chunkType)
Report the identifier of a chunk.
void FindChunk(int chunkType)
Start looking for a chunk from the start of the bank file.
~BankFileIO()
Close every file.
void PackChunkHeader(const char *header, std::vector< unsigned char > &data)
Copy a chunk header into eight bytes.
Stream of raw bytes, the base of the memory, file, and network streams.
Definition binstream.h:22
BinStream that reads or writes a file.
Definition filestream.h:14
Open file of the host or the disc.
Definition file.h:29
Double-buffered reader with one asynchronous read of a file always in flight.
Definition lazyfilestream.h:14
Growable text buffer that is also a PrnStream.
Definition string.h:19