|
DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
|
#include <Mp3File.h>


Public Member Functions | |
| ~Mp3File () override | |
| bool | openRead (const std::filesystem::path &path) override |
| Opens a file for reading. | |
| bool | openWrite (const std::filesystem::path &path, const AudioFileInfo &info) override |
| Opens a file for writing, creating it or overwriting if it exists. | |
| AudioFileInfo | getInfo () const override |
| Retrieves metadata of the currently opened file. | |
| bool | readSamples (AudioBufferView< float > dest) override |
| Reads samples from the start of the file into the destination view. | |
| bool | readSamples (AudioBufferView< float > dest, int64_t startFrame, int64_t numFrames) override |
| Reads a specific range of sample frames. Useful for chunked streaming. | |
| bool | writeSamples (AudioBufferView< const float > src) override |
| Writes samples from the view to the file. | |
| void | close () override |
| Finalizes file headers and releases system handles. | |
| bool | isOpen () const noexcept override |
| Checks if a valid file handle is currently open. | |
Public Member Functions inherited from dspark::AudioFile | |
| virtual | ~AudioFile ()=default |
|
inlineoverridevirtual |
Finalizes file headers and releases system handles.
Safe to call multiple times. Implementations invoke this from their destructor, so an open file is always finalized; call it explicitly when you need the write error-checked (a destructor cannot report failure) or the file released before the object dies.
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Retrieves metadata of the currently opened file.
Implements dspark::AudioFile.
|
inlineoverridevirtualnoexcept |
Checks if a valid file handle is currently open.
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Opens a file for reading.
Any previously open file is closed first.
| path | File path using C++20 std::filesystem (handles UTF-8/cross-platform safely). |
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Opens a file for writing, creating it or overwriting if it exists.
Any previously open file is closed first.
| path | File path. |
| info | Desired output format metadata. |
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Reads samples from the start of the file into the destination view.
Reads up to min(view length, file length) frames into up to min(view channels, file channels) channels. Excess buffer space and channels beyond those present in the file are left untouched.
| dest | Buffer view to receive the audio data. |
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Reads a specific range of sample frames. Useful for chunked streaming.
The requested range must lie entirely within the file (startFrame >= 0, numFrames > 0, startFrame + numFrames <= numSamples); out-of-range requests return false without reading. As with the full-file overload, the transfer is clamped to the view's capacity.
| dest | Buffer view to receive the audio data. |
| startFrame | The absolute frame index in the file to start reading from. |
| numFrames | The number of frames to read. |
Implements dspark::AudioFile.
|
inlineoverridevirtual |
Writes samples from the view to the file.
Converts float [-1.0, 1.0] back to the native bit-depth defined in openWrite(). May be called repeatedly to append blocks (streaming writes).
| src | Buffer view containing the data to write. |
Implements dspark::AudioFile.