|
NSUNI/NSLAR Library a250670
|
Provides data structures for representing essential components of audio data. More...
Classes | |
| struct | nnl::SAudio |
| Represents a simple audio asset. More... | |
Provides data structures for representing essential components of audio data.
This file defines the essential components of audio data. These structures facilitate the conversion of audio data between various common formats (such as WAV or MP3) and in-game formats.
| struct nnl::SAudio |
Represents a simple audio asset.
This structure serves as intermediary representation of audio data. It facilitate the conversion of audio data between various common formats (such as WAV or MP3) and in-game formats.
Public Member Functions | |
| void | ExportWAV (const std::filesystem::path &path) const |
| Exports the audio data to a WAV file. | |
| Buffer | ExportWAV () const |
| Exports the audio data to a WAV file. | |
| void | ToMono () |
| Converts stereo audio to mono. | |
Static Public Member Functions | |
| static SAudio | Import (const std::filesystem::path &path) |
| Constructs an audio asset from a WAV file located at the specified file path. | |
| static SAudio | Import (BufferView buffer) |
| Constructs an audio asset from a WAV file in the buffer. | |
Public Attributes | |
| std::string | name |
| An optional name of the audio asset. | |
| u32 | sample_rate = 0 |
| The sample rate of the audio (per second) | |
| u16 | num_channels = 1 |
| The number of audio channels (1 for mono, 2 for stereo). | |
| std::vector< i16 > | pcm |
| The PCM audio data stored as 16-bit samples. | |
|
nodiscard |
Exports the audio data to a WAV file.
This method saves the audio asset in the WAV format to a buffer.
| void nnl::SAudio::ExportWAV | ( | const std::filesystem::path & | path | ) | const |
Exports the audio data to a WAV file.
This method saves the audio asset to the given file path in the WAV format.
| path | The file path where the audio asset will be exported. |
|
staticnodiscard |
Constructs an audio asset from a WAV file in the buffer.
This method loads audio data from a WAV file in the buffer.
| buffer | The buffer containing a WAV file. |
|
staticnodiscard |
Constructs an audio asset from a WAV file located at the specified file path.
This method loads audio data from a WAV file located at the given path.
| path | The file path to the WAV file. |
| void nnl::SAudio::ToMono | ( | ) |
Converts stereo audio to mono.
This method combines 2 channels into 1.
| std::string nnl::SAudio::name |
An optional name of the audio asset.
| u16 nnl::SAudio::num_channels = 1 |
The number of audio channels (1 for mono, 2 for stereo).
| std::vector<i16> nnl::SAudio::pcm |
The PCM audio data stored as 16-bit samples.
| u32 nnl::SAudio::sample_rate = 0 |
The sample rate of the audio (per second)