DSPark 1.6.1
Header-only audio DSP framework in pure C++20 — zero dependencies
Loading...
Searching...
No Matches
dspark::AudioFileInfo Struct Reference

Metadata describing an audio file's format and dimensions. More...

#include <AudioFile.h>

Public Member Functions

AudioSpec toSpec (int defaultBlockSize=0) const noexcept
 Converts this file info to an AudioSpec for processor preparation.
 

Public Attributes

double sampleRate = 44100.0
 Sample rate in Hz (e.g., 44100.0, 48000.0, 96000.0).
 
uint32_t numChannels = 0
 Number of audio channels (1 = mono, 2 = stereo).
 
int64_t numSamples = 0
 Total number of sample frames in the file.
 
uint32_t bitsPerSample = 16
 Bits per sample in the stored format (8, 16, 24, 32, 64).
 
bool isFloatingPoint = false
 True if the file stores floating-point samples (IEEE 754).
 

Detailed Description

Metadata describing an audio file's format and dimensions.

Definition at line 38 of file AudioFile.h.

Member Function Documentation

◆ toSpec()

AudioSpec dspark::AudioFileInfo::toSpec ( int  defaultBlockSize = 0) const
inlinenoexcept

Converts this file info to an AudioSpec for processor preparation.

Warning
If processing offline in a single block, passing 0 will attempt to use the full file length. This can cause massive memory allocations for large files.
Note
The spec inherits this struct's dimensions verbatim. If the info describes an empty or unopened file (numChannels == 0 or numSamples == 0 with no explicit block size), the returned spec fails AudioSpec::isValid() – check it before calling prepare(). Framework processors reject invalid specs as a safe no-op.
Parameters
defaultBlockSizeDesired block size. Values <= 0 select the entire file length (offline single-block mode).
Returns
AudioSpec configured with the file's sample rate and channels.

Definition at line 78 of file AudioFile.h.

Member Data Documentation

◆ bitsPerSample

uint32_t dspark::AudioFileInfo::bitsPerSample = 16

Bits per sample in the stored format (8, 16, 24, 32, 64).

Note
Format-specific overload: when writing MP3 (Mp3File::openWrite), this field carries the target bitrate in kbps instead (e.g., 320). MP3 has no per-sample bit depth.

Definition at line 56 of file AudioFile.h.

◆ isFloatingPoint

bool dspark::AudioFileInfo::isFloatingPoint = false

True if the file stores floating-point samples (IEEE 754).

Definition at line 59 of file AudioFile.h.

◆ numChannels

uint32_t dspark::AudioFileInfo::numChannels = 0

Number of audio channels (1 = mono, 2 = stereo).

Definition at line 44 of file AudioFile.h.

◆ numSamples

int64_t dspark::AudioFileInfo::numSamples = 0

Total number of sample frames in the file.

Definition at line 47 of file AudioFile.h.

◆ sampleRate

double dspark::AudioFileInfo::sampleRate = 44100.0

Sample rate in Hz (e.g., 44100.0, 48000.0, 96000.0).

Definition at line 41 of file AudioFile.h.


The documentation for this struct was generated from the following file: