- cpp3ds
- OutputSoundFile
Provide write access to sound files. More...
#include <OutputSoundFile.hpp>
Public Member Functions | |
OutputSoundFile () | |
Default constructor. More... | |
~OutputSoundFile () | |
Destructor. More... | |
bool | openFromFile (const std::string &filename, unsigned int sampleRate, unsigned int channelCount) |
Open the sound file from the disk for writing. More... | |
void | write (const Int16 *samples, Uint64 count) |
Write audio samples to the file. More... | |
Provide write access to sound files.
This class encodes audio samples to a sound file.
It is used internally by higher-level classes such as cpp3ds::SoundBuffer, but can also be useful if you want to create audio files from custom data sources, like generated audio samples.
Usage example:
Definition at line 44 of file OutputSoundFile.hpp.
cpp3ds::OutputSoundFile::OutputSoundFile | ( | ) |
Default constructor.
cpp3ds::OutputSoundFile::~OutputSoundFile | ( | ) |
Destructor.
Closes the file if it was still open.
bool cpp3ds::OutputSoundFile::openFromFile | ( | const std::string & | filename, |
unsigned int | sampleRate, | ||
unsigned int | channelCount | ||
) |
Open the sound file from the disk for writing.
The supported audio formats are: WAV, OGG/Vorbis, FLAC.
filename | Path of the sound file to write |
sampleRate | Sample rate of the sound |
channelCount | Number of channels in the sound |
void cpp3ds::OutputSoundFile::write | ( | const Int16 * | samples, |
Uint64 | count | ||
) |
Write audio samples to the file.
samples | Pointer to the sample array to write |
count | Number of samples to write |