svcore  1.9
WavFileWriter Class Reference

#include <WavFileWriter.h>

Collaboration diagram for WavFileWriter:

Public Types

enum  FileWriteMode { WriteToTemporary, WriteToTarget }
 Specify the method used to open the destination file. More...
 

Public Member Functions

 WavFileWriter (QString path, int sampleRate, int channels, FileWriteMode mode)
 
virtual ~WavFileWriter ()
 
bool isOK () const
 
virtual QString getError () const
 
QString getPath () const
 
bool writeModel (DenseTimeValueModel *source, MultiSelection *selection=0)
 
bool writeSamples (float **samples, int count)
 
bool close ()
 

Protected Member Functions

QString getWriteFilename () const
 

Protected Attributes

QString m_path
 
int m_sampleRate
 
int m_channels
 
TempWriteFilem_temp
 
SNDFILE * m_file
 
QString m_error
 

Detailed Description

Definition at line 27 of file WavFileWriter.h.

Member Enumeration Documentation

◆ FileWriteMode

Specify the method used to open the destination file.

If WriteToTemporary, the destination will be opened as a temporary file which is moved to the target location when the WavFileWriter is closed or deleted (to avoid clobbering an existing file with a partially written replacement).

If WriteToTarget, the target file will be opened directly (necessary when e.g. doing a series of incremental writes to a file while keeping it open for reading).

Enumerator
WriteToTemporary 
WriteToTarget 

Definition at line 42 of file WavFileWriter.h.

Constructor & Destructor Documentation

◆ WavFileWriter()

WavFileWriter::WavFileWriter ( QString  path,
int  sampleRate,
int  channels,
FileWriteMode  mode 
)

◆ ~WavFileWriter()

WavFileWriter::~WavFileWriter ( )
virtual

Definition at line 69 of file WavFileWriter.cpp.

References close(), and m_file.

Member Function Documentation

◆ isOK()

bool WavFileWriter::isOK ( ) const

◆ getError()

QString WavFileWriter::getError ( ) const
virtual

◆ getPath()

QString WavFileWriter::getPath ( ) const
inline

Definition at line 55 of file WavFileWriter.h.

References m_path.

Referenced by WritableWaveFileModel::toXml(), and WritableWaveFileModel::WritableWaveFileModel().

◆ writeModel()

◆ writeSamples()

bool WavFileWriter::writeSamples ( float **  samples,
int  count 
)

Definition at line 162 of file WavFileWriter.cpp.

References getWriteFilename(), isOK(), m_channels, m_error, and m_file.

Referenced by WritableWaveFileModel::addSamples().

◆ close()

bool WavFileWriter::close ( )

Definition at line 190 of file WavFileWriter.cpp.

References m_file, m_temp, and TempWriteFile::moveToTarget().

Referenced by ~WavFileWriter().

◆ getWriteFilename()

QString WavFileWriter::getWriteFilename ( ) const
protected

Definition at line 87 of file WavFileWriter.cpp.

References TempWriteFile::getTemporaryFilename(), m_path, and m_temp.

Referenced by writeModel(), and writeSamples().

Member Data Documentation

◆ m_path

QString WavFileWriter::m_path
protected

Definition at line 65 of file WavFileWriter.h.

Referenced by getPath(), getWriteFilename(), and WavFileWriter().

◆ m_sampleRate

int WavFileWriter::m_sampleRate
protected

Definition at line 66 of file WavFileWriter.h.

Referenced by WavFileWriter().

◆ m_channels

int WavFileWriter::m_channels
protected

Definition at line 67 of file WavFileWriter.h.

Referenced by WavFileWriter(), writeModel(), and writeSamples().

◆ m_temp

TempWriteFile* WavFileWriter::m_temp
protected

Definition at line 68 of file WavFileWriter.h.

Referenced by close(), getWriteFilename(), and WavFileWriter().

◆ m_file

SNDFILE* WavFileWriter::m_file
protected

Definition at line 69 of file WavFileWriter.h.

Referenced by close(), WavFileWriter(), writeModel(), writeSamples(), and ~WavFileWriter().

◆ m_error

QString WavFileWriter::m_error
protected

Definition at line 70 of file WavFileWriter.h.

Referenced by getError(), isOK(), WavFileWriter(), writeModel(), and writeSamples().


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