tracktion-engine 3.0-10-g034fdde4aa5
Tracktion Engine — High level data model for audio applications

« « « Anklang Documentation
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
tracktion::engine::AudioFileWriter Class Reference

Smart wrapper for writing to an audio file. More...

#include "tracktion_AudioFileWriter.h"

Inheritance diagram for tracktion::engine::AudioFileWriter:
juce::ReferenceCountedObject

Public Member Functions

 AudioFileWriter (const AudioFile &file, juce::AudioFormat *formatToUse, int numChannels, double sampleRate, int bitsPerSample, const juce::StringPairArray &metadata, int quality)
 
 ~AudioFileWriter ()
 Destructor, calls closeForWriting.
 
bool isOpen () const noexcept
 Returns true if the file is open and ready to write to.
 
double getSampleRate () const noexcept
 Returns the sample rate of the writer, should only be called on an open writer.
 
int getNumChannels () const noexcept
 Returns the num channels of the writer, should only be called on an open writer.
 
bool appendBuffer (juce::AudioBuffer< float > &buffer, int numSamples)
 Appends an AudioBuffer to the file.
 
bool appendBuffer (const int **buffer, int numSamples)
 Appends an block of samples to the file.
 
bool writeFromAudioReader (juce::AudioFormatReader &, SampleCount startSample, SampleCount numSamples)
 Appends a block of samples to the file from an audio format reader.
 
void closeForWriting ()
 Deletes the writer and releases the file handle.
 
- Public Member Functions inherited from juce::ReferenceCountedObject
void incReferenceCount () noexcept
 
void decReferenceCount () noexcept
 
bool decReferenceCountWithoutDeleting () noexcept
 
int getReferenceCount () const noexcept
 

Public Attributes

AudioFile file
 

Additional Inherited Members

- Protected Member Functions inherited from juce::ReferenceCountedObject
 ReferenceCountedObject (const ReferenceCountedObject &) noexcept
 
 ReferenceCountedObject (ReferenceCountedObject &&) noexcept
 
ReferenceCountedObjectoperator= (const ReferenceCountedObject &) noexcept
 
ReferenceCountedObjectoperator= (ReferenceCountedObject &&) noexcept
 
void resetReferenceCount () noexcept
 

Detailed Description

Smart wrapper for writing to an audio file.

Internally this opens a File for writng and provides some helper methods to append to it and free the file handle when done.

Definition at line 21 of file tracktion_AudioFileWriter.h.

Constructor & Destructor Documentation

◆ AudioFileWriter()

tracktion::engine::AudioFileWriter::AudioFileWriter ( const AudioFile file,
juce::AudioFormat formatToUse,
int  numChannels,
double  sampleRate,
int  bitsPerSample,
const juce::StringPairArray metadata,
int  quality 
)

Definition at line 146 of file tracktion_AudioFile.cpp.

◆ ~AudioFileWriter()

tracktion::engine::AudioFileWriter::~AudioFileWriter ( )

Destructor, calls closeForWriting.

Definition at line 167 of file tracktion_AudioFile.cpp.

Member Function Documentation

◆ appendBuffer() [1/2]

bool tracktion::engine::AudioFileWriter::appendBuffer ( const int **  buffer,
int  numSamples 
)

Appends an block of samples to the file.

Definition at line 209 of file tracktion_AudioFile.cpp.

◆ appendBuffer() [2/2]

bool tracktion::engine::AudioFileWriter::appendBuffer ( juce::AudioBuffer< float > &  buffer,
int  numSamples 
)

Appends an AudioBuffer to the file.

Definition at line 188 of file tracktion_AudioFile.cpp.

◆ closeForWriting()

void tracktion::engine::AudioFileWriter::closeForWriting ( )

Deletes the writer and releases the file handle.

Definition at line 176 of file tracktion_AudioFile.cpp.

◆ getNumChannels()

int tracktion::engine::AudioFileWriter::getNumChannels ( ) const
noexcept

Returns the num channels of the writer, should only be called on an open writer.

Definition at line 174 of file tracktion_AudioFile.cpp.

◆ getSampleRate()

double tracktion::engine::AudioFileWriter::getSampleRate ( ) const
noexcept

Returns the sample rate of the writer, should only be called on an open writer.

Definition at line 173 of file tracktion_AudioFile.cpp.

◆ isOpen()

bool tracktion::engine::AudioFileWriter::isOpen ( ) const
noexcept

Returns true if the file is open and ready to write to.

Definition at line 172 of file tracktion_AudioFile.cpp.

◆ writeFromAudioReader()

bool tracktion::engine::AudioFileWriter::writeFromAudioReader ( juce::AudioFormatReader reader,
SampleCount  startSample,
SampleCount  numSamples 
)

Appends a block of samples to the file from an audio format reader.

Definition at line 215 of file tracktion_AudioFile.cpp.

Member Data Documentation

◆ file

AudioFile tracktion::engine::AudioFileWriter::file

Definition at line 58 of file tracktion_AudioFileWriter.h.


The documentation for this class was generated from the following files: