mirror of
https://github.com/thestk/stk
synced 2026-01-13 13:01:52 +00:00
328 lines
15 KiB
HTML
328 lines
15 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>The Synthesis ToolKit in C++ (STK)</TITLE>
|
|
<LINK HREF="doxygen.css" REL="stylesheet" TYPE="text/css">
|
|
</HEAD>
|
|
<BODY BGCOLOR="#FFFFFF">
|
|
<CENTER>
|
|
<img src="princeton.gif"> <img src="ccrma.gif"> <img src="mcgill.gif"><P>
|
|
<a class="qindex" href="index.html">Home</a> <a class="qindex" href="information.html">Information</a> <a class="qindex" href="classes.html">Classes</a> <a class="qindex" href="download.html">Download</a> <a class="qindex" href="usage.html">Usage</a> <a class="qindex" href="maillist.html">Mail List</a> <a class="qindex" href="system.html">Requirements</a> <a class="qindex" href="links.html">Links</a> <a class="qindex" href="faq.html">FAQ</a> <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
|
|
<HR>
|
|
<!-- Generated by Doxygen 1.4.4 -->
|
|
<h1>FileWrite Class Reference</h1><!-- doxytag: class="FileWrite" --><!-- doxytag: inherits="Stk" --><code>#include <<a class="el" href="FileWrite_8h-source.html">FileWrite.h</a>></code>
|
|
<p>
|
|
<p>Inheritance diagram for FileWrite:
|
|
<p><center><img src="classFileWrite.png" usemap="#FileWrite_map" border="0" alt=""></center>
|
|
<map name="FileWrite_map">
|
|
<area href="classStk.html" alt="Stk" shape="rect" coords="0,0,62,24">
|
|
</map>
|
|
<a href="classFileWrite-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>
|
|
STK audio file output class.
|
|
<p>
|
|
This class provides output support for various audio file formats.<p>
|
|
FileWrite writes samples to an audio file. It supports multi-channel data.<p>
|
|
FileWrite currently supports uncompressed WAV, AIFF, AIFC, SND (AU), MAT-file (Matlab), and STK RAW file formats. Signed integer (8-, 16-, and 32-bit) and floating- point (32- and 64-bit) data types are supported. STK RAW files use 16-bit integers by definition. MAT-files will always be written as 64-bit floats. If a data type specification does not match the specified file type, the data type will automatically be modified. Compressed data types are not supported.<p>
|
|
by Perry R. Cook and Gary P. Scavone, 1995 - 2007.
|
|
<p>
|
|
<table border="0" cellpadding="0" cellspacing="0">
|
|
<tr><td></td></tr>
|
|
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a0"></a><!-- doxytag: member="FileWrite::FileWrite" ref="a0" args="()" -->
|
|
</td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a0">FileWrite</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a1">FileWrite</a> (std::string fileName, unsigned int nChannels=1, FILE_TYPE type=<a class="el" href="classFileWrite.html#s1">FILE_WAV</a>, Stk::StkFormat format=<a class="el" href="classStk.html#s1">STK_SINT16</a>)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Overloaded constructor used to specify a file name, type, and data format with this object. <a href="#a1"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a2"></a><!-- doxytag: member="FileWrite::~FileWrite" ref="a2" args="()" -->
|
|
virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a2">~FileWrite</a> ()</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a3">open</a> (std::string fileName, unsigned int nChannels=1, FileWrite::FILE_TYPE type=<a class="el" href="classFileWrite.html#s1">FILE_WAV</a>, Stk::StkFormat format=<a class="el" href="classStk.html#s1">STK_SINT16</a>)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a file of the specified type and name and output samples to it in the given data format. <a href="#a3"></a><br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a4"></a><!-- doxytag: member="FileWrite::close" ref="a4" args="(void)" -->
|
|
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a4">close</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">If a file is open, write out samples in the queue and then close it. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="a5"></a><!-- doxytag: member="FileWrite::isOpen" ref="a5" args="(void)" -->
|
|
bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a5">isOpen</a> (void)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns <em>true</em> if a file is currently open. <br></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#a6">write</a> (<a class="el" href="classStkFrames.html">StkFrames</a> &buffer)</td></tr>
|
|
|
|
<tr><td class="mdescLeft"> </td><td class="mdescRight">Write sample frames from the <a class="el" href="classStkFrames.html">StkFrames</a> object to the file. <a href="#a6"></a><br></td></tr>
|
|
<tr><td colspan="2"><br><h2>Static Public Attributes</h2></td></tr>
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const FILE_TYPE </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#s0">FILE_RAW</a></td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const FILE_TYPE </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#s1">FILE_WAV</a></td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const FILE_TYPE </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#s2">FILE_SND</a></td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const FILE_TYPE </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#s3">FILE_AIF</a></td></tr>
|
|
|
|
<tr><td class="memItemLeft" nowrap align="right" valign="top">static const FILE_TYPE </td><td class="memItemRight" valign="bottom"><a class="el" href="classFileWrite.html#s4">FILE_MAT</a></td></tr>
|
|
|
|
</table>
|
|
<hr><h2>Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" name="a1"></a><!-- doxytag: member="FileWrite::FileWrite" ref="a1" args="(std::string fileName, unsigned int nChannels=1, FILE_TYPE type=FILE_WAV, Stk::StkFormat format=STK_SINT16)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">FileWrite::FileWrite </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">std::string </td>
|
|
<td class="mdname" nowrap> <em>fileName</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>unsigned int </td>
|
|
<td class="mdname" nowrap> <em>nChannels</em> = <code>1</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>FILE_TYPE </td>
|
|
<td class="mdname" nowrap> <em>type</em> = <code><a class="el" href="classFileWrite.html#s1">FILE_WAV</a></code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>Stk::StkFormat </td>
|
|
<td class="mdname" nowrap> <em>format</em> = <code><a class="el" href="classStk.html#s1">STK_SINT16</a></code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md"></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Overloaded constructor used to specify a file name, type, and data format with this object.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> is thrown for invalid argument values or if an error occurs when initializing the output file. </td>
|
|
</tr>
|
|
</table>
|
|
<hr><h2>Member Function Documentation</h2>
|
|
<a class="anchor" name="a3"></a><!-- doxytag: member="FileWrite::open" ref="a3" args="(std::string fileName, unsigned int nChannels=1, FileWrite::FILE_TYPE type=FILE_WAV, Stk::StkFormat format=STK_SINT16)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void FileWrite::open </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top">std::string </td>
|
|
<td class="mdname" nowrap> <em>fileName</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>unsigned int </td>
|
|
<td class="mdname" nowrap> <em>nChannels</em> = <code>1</code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>FileWrite::FILE_TYPE </td>
|
|
<td class="mdname" nowrap> <em>type</em> = <code><a class="el" href="classFileWrite.html#s1">FILE_WAV</a></code>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md" nowrap align="right"></td>
|
|
<td class="md"></td>
|
|
<td class="md" nowrap>Stk::StkFormat </td>
|
|
<td class="mdname" nowrap> <em>format</em> = <code><a class="el" href="classStk.html#s1">STK_SINT16</a></code></td>
|
|
</tr>
|
|
<tr>
|
|
<td class="md"></td>
|
|
<td class="md">) </td>
|
|
<td class="md" colspan="2"></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Create a file of the specified type and name and output samples to it in the given data format.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> is thrown for invalid argument values or if an error occurs when initializing the output file. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="a6"></a><!-- doxytag: member="FileWrite::write" ref="a6" args="(StkFrames &buffer)" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">void FileWrite::write </td>
|
|
<td class="md" valign="top">( </td>
|
|
<td class="md" nowrap valign="top"><a class="el" href="classStkFrames.html">StkFrames</a> & </td>
|
|
<td class="mdname1" valign="top" nowrap> <em>buffer</em> </td>
|
|
<td class="md" valign="top"> ) </td>
|
|
<td class="md" nowrap></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Write sample frames from the <a class="el" href="classStkFrames.html">StkFrames</a> object to the file.
|
|
<p>
|
|
An <a class="el" href="classStkError.html">StkError</a> will be thrown if the number of channels in the <a class="el" href="classStkFrames.html">StkFrames</a> argument does not agree with the number of channels specified when opening the file. </td>
|
|
</tr>
|
|
</table>
|
|
<hr><h2>Member Data Documentation</h2>
|
|
<a class="anchor" name="s0"></a><!-- doxytag: member="FileWrite::FILE_RAW" ref="s0" args="" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">const FILE_TYPE <a class="el" href="classFileWrite.html#s0">FileWrite::FILE_RAW</a><code> [static]</code> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
STK RAW file type. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="s1"></a><!-- doxytag: member="FileWrite::FILE_WAV" ref="s1" args="" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">const FILE_TYPE <a class="el" href="classFileWrite.html#s1">FileWrite::FILE_WAV</a><code> [static]</code> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
WAV file type. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="s2"></a><!-- doxytag: member="FileWrite::FILE_SND" ref="s2" args="" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">const FILE_TYPE <a class="el" href="classFileWrite.html#s2">FileWrite::FILE_SND</a><code> [static]</code> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
SND (AU) file type. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="s3"></a><!-- doxytag: member="FileWrite::FILE_AIF" ref="s3" args="" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">const FILE_TYPE <a class="el" href="classFileWrite.html#s3">FileWrite::FILE_AIF</a><code> [static]</code> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
AIFF file type. </td>
|
|
</tr>
|
|
</table>
|
|
<a class="anchor" name="s4"></a><!-- doxytag: member="FileWrite::FILE_MAT" ref="s4" args="" --><p>
|
|
<table class="mdTable" cellpadding="2" cellspacing="0">
|
|
<tr>
|
|
<td class="mdRow">
|
|
<table cellpadding="0" cellspacing="0" border="0">
|
|
<tr>
|
|
<td class="md" nowrap valign="top">const FILE_TYPE <a class="el" href="classFileWrite.html#s4">FileWrite::FILE_MAT</a><code> [static]</code> </td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<table cellspacing="5" cellpadding="0" border="0">
|
|
<tr>
|
|
<td>
|
|
|
|
</td>
|
|
<td>
|
|
|
|
<p>
|
|
Matlab MAT-file type. </td>
|
|
</tr>
|
|
</table>
|
|
<hr>The documentation for this class was generated from the following file:<ul>
|
|
<li><a class="el" href="FileWrite_8h-source.html">FileWrite.h</a></ul>
|
|
<HR>
|
|
|
|
<table>
|
|
<tr><td><A HREF="http://ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
|
|
<tr><td>©1995-2007 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|