1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240
|
<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.6.2 -->
<div class="navpath"><a class="el" href="namespacestk.html">stk</a>::<a class="el" href="classstk_1_1FileRead.html">FileRead</a>
</div>
<div class="contents">
<h1>stk::FileRead Class Reference</h1><!-- doxytag: class="stk::FileRead" --><!-- doxytag: inherits="stk::Stk" -->
<p>STK audio file input class.
<a href="#_details">More...</a></p>
<p><code>#include <<a class="el" href="FileRead_8h_source.html">FileRead.h</a>></code></p>
<div class="dynheader">
Inheritance diagram for stk::FileRead:</div>
<div class="dynsection">
<div class="center">
<img src="classstk_1_1FileRead.png" usemap="#stk::FileRead_map" alt=""/>
<map id="stk::FileRead_map" name="stk::FileRead_map">
<area href="classstk_1_1Stk.html" alt="stk::Stk" shape="rect" coords="0,0,83,24"/>
</map>
</div>
</div>
<p><a href="classstk_1_1FileRead-members.html">List of all members.</a></p>
<table border="0" cellpadding="0" cellspacing="0">
<tr><td colspan="2"><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a9b8c55af1ca997dd3b808afcc54f3089"></a><!-- doxytag: member="stk::FileRead::FileRead" ref="a9b8c55af1ca997dd3b808afcc54f3089" args="(void)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089">FileRead</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Default constructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#aef47f180e2d7ef77a118b993541b372d">FileRead</a> (std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=<a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate=22050.0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Overloaded constructor that opens a file during instantiation. <a href="#aef47f180e2d7ef77a118b993541b372d"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a24802c0e1846ea9f420f40293af4cde4"></a><!-- doxytag: member="stk::FileRead::~FileRead" ref="a24802c0e1846ea9f420f40293af4cde4" args="(void)" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4">~FileRead</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Class destructor. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157">open</a> (std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=<a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate=22050.0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Open the specified file and determine its formatting. <a href="#acc11b53871e05af1b0342e2cc1fc3157"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a56d09169c0cca8623823579c7f80808a"></a><!-- doxytag: member="stk::FileRead::close" ref="a56d09169c0cca8623823579c7f80808a" args="(void)" -->
void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a">close</a> (void)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">If a file is open, close it. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a3f30ed2a9f45493f0369aa2edbf38f70"></a><!-- doxytag: member="stk::FileRead::isOpen" ref="a3f30ed2a9f45493f0369aa2edbf38f70" args="(void)" -->
bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70">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" align="right" valign="top"><a class="anchor" id="a6a83d925dd5bd18c4299ea42cc0ea488"></a><!-- doxytag: member="stk::FileRead::fileSize" ref="a6a83d925dd5bd18c4299ea42cc0ea488" args="(void) const " -->
unsigned long </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488">fileSize</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the file size in sample frames. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a4c0c35f1817a4984b325967f1e7bcd81"></a><!-- doxytag: member="stk::FileRead::channels" ref="a4c0c35f1817a4984b325967f1e7bcd81" args="(void) const " -->
unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81">channels</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the number of audio channels in the file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6852b303c34f01967be2a7a69221ef0b"></a><!-- doxytag: member="stk::FileRead::format" ref="a6852b303c34f01967be2a7a69221ef0b" args="(void) const " -->
StkFormat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b">format</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the data format of the file. <br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">StkFloat </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199">fileRate</a> (void) const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Return the file sample rate in Hz. <a href="#a7d6ba525b2f8ae693d953cb7f4b7c199"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8">read</a> (<a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> &buffer, unsigned long startFrame=0, bool doNormalize=true)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Read sample frames from the file into an <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object. <a href="#a8eefe5d1479789c02ac2dfa76ba143f8"></a><br/></td></tr>
</table>
<hr/><a name="_details"></a><h2>Detailed Description</h2>
<p>STK audio file input class. </p>
<p>This class provides input support for various audio file formats. Multi-channel (>2) soundfiles are supported. The file data is returned via an external <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object passed to the <a class="el" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read()</a> function. This class does not store its own copy of the file data, rather the data is read directly from disk.</p>
<p><a class="el" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> currently supports uncompressed WAV, AIFF/AIFC, SND (AU), MAT-file (Matlab), and STK RAW file formats. Signed integer (8-, 16-, 24-, and 32-bit) and floating-point (32- and 64-bit) data types are supported. Compressed data types are not supported.</p>
<p>STK RAW files have no header and are assumed to contain a monophonic stream of 16-bit signed integers in big-endian byte order at a sample rate of 22050 Hz. MAT-file data should be saved in an array with each data channel filling a matrix row. The sample rate for MAT-files should be specified in a variable named "fs". If no such variable is found, the sample rate is assumed to be 44100 Hz.</p>
<p>by Perry R. Cook and Gary P. Scavone, 1995-2012. </p>
<hr/><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" id="aef47f180e2d7ef77a118b993541b372d"></a><!-- doxytag: member="stk::FileRead::FileRead" ref="aef47f180e2d7ef77a118b993541b372d" args="(std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=STK_SINT16, StkFloat rate=22050.0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">stk::FileRead::FileRead </td>
<td>(</td>
<td class="paramtype">std::string </td>
<td class="paramname"> <em>fileName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>typeRaw</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>nChannels</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFormat </td>
<td class="paramname"> <em>format</em> = <code><a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>rate</em> = <code>22050.0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Overloaded constructor that opens a file during instantiation. </p>
<p>An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if the file is not found or its format is unknown or unsupported. The optional arguments allow a headerless file type to be supported. If <code>typeRaw</code> is false (the default), the subsequent parameters are ignored. </p>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="acc11b53871e05af1b0342e2cc1fc3157"></a><!-- doxytag: member="stk::FileRead::open" ref="acc11b53871e05af1b0342e2cc1fc3157" args="(std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=STK_SINT16, StkFloat rate=22050.0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::FileRead::open </td>
<td>(</td>
<td class="paramtype">std::string </td>
<td class="paramname"> <em>fileName</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>typeRaw</em> = <code>false</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned int </td>
<td class="paramname"> <em>nChannels</em> = <code>1</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFormat </td>
<td class="paramname"> <em>format</em> = <code><a class="el" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a></code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">StkFloat </td>
<td class="paramname"> <em>rate</em> = <code>22050.0</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Open the specified file and determine its formatting. </p>
<p>An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if the file is not found or its format is unknown or unsupported. The optional arguments allow a headerless file type to be supported. If <code>typeRaw</code> is false (the default), the subsequent parameters are ignored. </p>
</div>
</div>
<a class="anchor" id="a7d6ba525b2f8ae693d953cb7f4b7c199"></a><!-- doxytag: member="stk::FileRead::fileRate" ref="a7d6ba525b2f8ae693d953cb7f4b7c199" args="(void) const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">StkFloat stk::FileRead::fileRate </td>
<td>(</td>
<td class="paramtype">void </td>
<td class="paramname"></td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Return the file sample rate in Hz. </p>
<p>WAV, SND, and AIF formatted files specify a sample rate in their headers. By definition, STK RAW files have a sample rate of 22050 Hz. MAT-files are assumed to have a rate of 44100 Hz. </p>
<p><div class="fragment"><pre class="fragment"><a name="l00091"></a>00091 { <span class="keywordflow">return</span> fileRate_; };
</pre></div></p>
</div>
</div>
<a class="anchor" id="a8eefe5d1479789c02ac2dfa76ba143f8"></a><!-- doxytag: member="stk::FileRead::read" ref="a8eefe5d1479789c02ac2dfa76ba143f8" args="(StkFrames &buffer, unsigned long startFrame=0, bool doNormalize=true)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void stk::FileRead::read </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classstk_1_1StkFrames.html">StkFrames</a> & </td>
<td class="paramname"> <em>buffer</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">unsigned long </td>
<td class="paramname"> <em>startFrame</em> = <code>0</code>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>doNormalize</em> = <code>true</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>Read sample frames from the file into an <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object. </p>
<p>The number of sample frames to read will be determined from the number of frames of the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument. If this size is larger than the available data in the file (given the file size and starting frame index), the extra frames will be unaffected (the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> object will not be resized). Optional parameters are provided to specify the starting sample frame within the file (default = 0) and whether to normalize the data with respect to fixed-point limits (default = true). An <a class="el" href="classstk_1_1StkError.html" title="STK error handling class.">StkError</a> will be thrown if a file error occurs or if the number of channels in the <a class="el" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a> argument is not equal to that in the file. </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="FileRead_8h_source.html">FileRead.h</a></li>
</ul>
</div>
<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-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>
|