mirror of
https://github.com/thestk/stk
synced 2026-01-11 20:11:52 +00:00
100 lines
10 KiB
HTML
100 lines
10 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.6.2 -->
|
|
<div class="navpath"><a class="el" href="dir_f14fd23bc74c76f288031ad23b3f3505.html">include</a>
|
|
</div>
|
|
<div class="contents">
|
|
<h1>FileRead.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEREAD_H</span>
|
|
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEREAD_H</span>
|
|
<a name="l00003"></a>00003 <span class="preprocessor"></span>
|
|
<a name="l00004"></a>00004 <span class="preprocessor">#include "Stk.h"</span>
|
|
<a name="l00005"></a>00005
|
|
<a name="l00006"></a>00006 <span class="keyword">namespace </span>stk {
|
|
<a name="l00007"></a>00007
|
|
<a name="l00008"></a>00008 <span class="comment">/***************************************************/</span>
|
|
<a name="l00039"></a>00039 <span class="comment">/***************************************************/</span>
|
|
<a name="l00040"></a>00040
|
|
<a name="l00041"></a><a class="code" href="classstk_1_1FileRead.html">00041</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html" title="STK audio file input class.">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
|
|
<a name="l00042"></a>00042 {
|
|
<a name="l00043"></a>00043 <span class="keyword">public</span>:
|
|
<a name="l00045"></a>00045 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00046"></a>00046
|
|
<a name="l00048"></a>00048
|
|
<a name="l00054"></a>00054 <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089" title="Default constructor.">FileRead</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
|
<a name="l00055"></a>00055 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
|
<a name="l00056"></a>00056
|
|
<a name="l00058"></a>00058 <a class="code" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4" title="Class destructor.">~FileRead</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00059"></a>00059
|
|
<a name="l00061"></a>00061
|
|
<a name="l00067"></a>00067 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157" title="Open the specified file and determine its formatting.">open</a>( std::string fileName, <span class="keywordtype">bool</span> typeRaw = <span class="keyword">false</span>, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
|
|
<a name="l00068"></a>00068 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );
|
|
<a name="l00069"></a>00069
|
|
<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a" title="If a file is open, close it.">close</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00072"></a>00072
|
|
<a name="l00074"></a>00074 <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
|
|
<a name="l00075"></a>00075
|
|
<a name="l00077"></a><a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488">00077</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#a6a83d925dd5bd18c4299ea42cc0ea488" title="Return the file size in sample frames.">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };
|
|
<a name="l00078"></a>00078
|
|
<a name="l00080"></a><a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81">00080</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#a4c0c35f1817a4984b325967f1e7bcd81" title="Return the number of audio channels in the file.">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };
|
|
<a name="l00081"></a>00081
|
|
<a name="l00083"></a><a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b">00083</a> StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dataType_; };
|
|
<a name="l00084"></a>00084
|
|
<a name="l00086"></a>00086
|
|
<a name="l00091"></a><a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199">00091</a> StkFloat <a class="code" href="classstk_1_1FileRead.html#a7d6ba525b2f8ae693d953cb7f4b7c199" title="Return the file sample rate in Hz.">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };
|
|
<a name="l00092"></a>00092
|
|
<a name="l00094"></a>00094
|
|
<a name="l00106"></a>00106 <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8" title="Read sample frames from the file into an StkFrames object.">read</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>& buffer, <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> startFrame = 0, <span class="keywordtype">bool</span> doNormalize = <span class="keyword">true</span> );
|
|
<a name="l00107"></a>00107
|
|
<a name="l00108"></a>00108 <span class="keyword">protected</span>:
|
|
<a name="l00109"></a>00109
|
|
<a name="l00110"></a>00110 <span class="comment">// Get STK RAW file information.</span>
|
|
<a name="l00111"></a>00111 <span class="keywordtype">bool</span> getRawInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels,
|
|
<a name="l00112"></a>00112 StkFormat <a class="code" href="classstk_1_1FileRead.html#a6852b303c34f01967be2a7a69221ef0b" title="Return the data format of the file.">format</a>, StkFloat rate );
|
|
<a name="l00113"></a>00113
|
|
<a name="l00114"></a>00114 <span class="comment">// Get WAV file header information.</span>
|
|
<a name="l00115"></a>00115 <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
|
<a name="l00116"></a>00116
|
|
<a name="l00117"></a>00117 <span class="comment">// Get SND (AU) file header information.</span>
|
|
<a name="l00118"></a>00118 <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
|
<a name="l00119"></a>00119
|
|
<a name="l00120"></a>00120 <span class="comment">// Get AIFF file header information.</span>
|
|
<a name="l00121"></a>00121 <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
|
<a name="l00122"></a>00122
|
|
<a name="l00123"></a>00123 <span class="comment">// Get MAT-file header information.</span>
|
|
<a name="l00124"></a>00124 <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );
|
|
<a name="l00125"></a>00125
|
|
<a name="l00126"></a>00126 <span class="comment">// Helper function for MAT-file parsing.</span>
|
|
<a name="l00127"></a>00127 <span class="keywordtype">bool</span> findNextMatArray( SINT32 *chunkSize, SINT32 *rows, SINT32 *columns, SINT32 *nametype );
|
|
<a name="l00128"></a>00128
|
|
<a name="l00129"></a>00129 FILE *fd_;
|
|
<a name="l00130"></a>00130 <span class="keywordtype">bool</span> byteswap_;
|
|
<a name="l00131"></a>00131 <span class="keywordtype">bool</span> wavFile_;
|
|
<a name="l00132"></a>00132 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;
|
|
<a name="l00133"></a>00133 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;
|
|
<a name="l00134"></a>00134 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
|
|
<a name="l00135"></a>00135 StkFormat dataType_;
|
|
<a name="l00136"></a>00136 StkFloat fileRate_;
|
|
<a name="l00137"></a>00137 };
|
|
<a name="l00138"></a>00138
|
|
<a name="l00139"></a>00139 } <span class="comment">// stk namespace</span>
|
|
<a name="l00140"></a>00140
|
|
<a name="l00141"></a>00141 <span class="preprocessor">#endif</span>
|
|
</pre></div></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-2011 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
|
|
</table>
|
|
|
|
</BODY>
|
|
</HTML>
|