Source WAV file of a sample, and its conversion to the console's formats.
More...
#include <AudioIO.h>
|
| | AudioIO (const String &filename) |
| | Read the format of a WAV file.
|
| | ~AudioIO () |
| | Release the reader.
|
| bool | ReadWavData (std::vector< unsigned char > &data) |
| | Read the file's samples and record its format.
|
| void | GetStreamData (std::vector< unsigned char > &data) |
| | Convert a 48 kHz 16-bit stereo file to the layout of a streamed sample.
|
| void | FindZeroCrossings (std::vector< int > &crossings) |
| | List the start of every 28-sample block at which the waveform crosses zero.
|
| void | GetVagData (std::vector< unsigned char > &vagData, int iLoopStart, int iLoopEnd) |
| | Encode the file as VAG data, looping between two samples when the points are valid.
|
| bool | operator! () const |
| | Report whether the last read failed.
|
| int | GetNumChannels () const |
| | Report the number of channels.
|
| int | GetSampleRate () const |
| | Report the sample rate.
|
| int | GetBitsPerSample () const |
| | Report the size of one sample.
|
| String & | GetFilename () |
| | Report the path of the file.
|
| int | GetVagSize () const |
| | Report the size of the VAG data of the file, before any loop adjustment.
|
Source WAV file of a sample, and its conversion to the console's formats.
The class has no RTTI, and its name is inferred from its source file. The object is 0x28 bytes. The constructor reads the file once to learn its format. Every conversion reads it again.
◆ AudioIO()
| AudioIO::AudioIO |
( |
const String & | filename | ) |
|
|
explicit |
Read the format of a WAV file.
- Parameters
-
| filename | The path of the file. |
- Ghidra address:
- 0x10029a16
◆ ~AudioIO()
Release the reader.
- Ghidra address:
- 0x10029abd
◆ ReadWavData()
| bool AudioIO::ReadWavData |
( |
std::vector< unsigned char > & | data | ) |
|
Read the file's samples and record its format.
- Parameters
-
| data | Receives the bytes of the data chunk. |
- Returns
- Whether the file was a WAV file with data.
- Ghidra address:
- 0x10029898
◆ GetStreamData()
| void AudioIO::GetStreamData |
( |
std::vector< unsigned char > & | data | ) |
|
Convert a 48 kHz 16-bit stereo file to the layout of a streamed sample.
Every 0x400 bytes store 256 samples of the left channel and then 256 of the right. The result has at least 0x800 bytes of silence at the end. A file in another format produces a notice and no data.
- Parameters
-
| data | Receives the converted data. |
- Ghidra address:
- 0x10029ad3
◆ FindZeroCrossings()
| void AudioIO::FindZeroCrossings |
( |
std::vector< int > & | crossings | ) |
|
List the start of every 28-sample block at which the waveform crosses zero.
- Parameters
-
| crossings | Receives the sample index of each crossing. |
- Ghidra address:
- 0x10029f04
◆ GetVagData()
| void AudioIO::GetVagData |
( |
std::vector< unsigned char > & | vagData, |
|
|
int | iLoopStart, |
|
|
int | iLoopEnd ) |
Encode the file as VAG data, looping between two samples when the points are valid.
- Parameters
-
| vagData | Receives the VAG data. |
| iLoopStart | The first sample of the loop. |
| iLoopEnd | The sample at which the loop ends, or zero for a one-shot sample. |
- Ghidra address:
- 0x1002a0c3
◆ operator!()
| bool AudioIO::operator! |
( |
| ) |
const |
|
inline |
Report whether the last read failed.
- Returns
- Whether the last read failed.
- Ghidra address:
- 0x100202b0
◆ GetNumChannels()
| int AudioIO::GetNumChannels |
( |
| ) |
const |
|
inline |
Report the number of channels.
- Returns
- The number of channels.
◆ GetSampleRate()
| int AudioIO::GetSampleRate |
( |
| ) |
const |
|
inline |
Report the sample rate.
- Returns
- The sample rate in hertz.
◆ GetBitsPerSample()
| int AudioIO::GetBitsPerSample |
( |
| ) |
const |
|
inline |
Report the size of one sample.
- Returns
- The size in bits.
◆ GetFilename()
| String & AudioIO::GetFilename |
( |
| ) |
|
|
inline |
Report the path of the file.
- Returns
- The path.
◆ GetVagSize()
| int AudioIO::GetVagSize |
( |
| ) |
const |
|
inline |
Report the size of the VAG data of the file, before any loop adjustment.
- Returns
- The size in bytes.
The documentation for this class was generated from the following file: