forked from pschatzmann/arduino-stk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileRead_8h_source.html
138 lines (138 loc) · 19.9 KB
/
FileRead_8h_source.html
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Arduino STK: FileRead.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">Arduino STK
 <span id="projectnumber">4.6.2</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_68267d1309a1af8e8297ef4c3efbcdba.html">src</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">FileRead.h</div> </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span> <span class="preprocessor">#ifndef STK_FILEREAD_H</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define STK_FILEREAD_H</span></div>
<div class="line"><a name="l00003"></a><span class="lineno"> 3</span>  </div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span> <span class="preprocessor">#include "Stk.h"</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>  </div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span> <span class="keyword">namespace </span><a class="code" href="namespacestk.html">stk</a> {</div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>  </div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span> <span class="comment">/***************************************************/</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span> <span class="comment">/***************************************************/</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>  </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html"> 41</a></span> <span class="keyword">class </span><a class="code" href="classstk_1_1FileRead.html">FileRead</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html">Stk</a></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span> {</div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span> <span class="keyword">public</span>:</div>
<div class="line"><a name="l00045"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089"> 45</a></span>  <a class="code" href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089">FileRead</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>  </div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>  </div>
<div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#aef47f180e2d7ef77a118b993541b372d"> 54</a></span>  <a class="code" href="classstk_1_1FileRead.html#aef47f180e2d7ef77a118b993541b372d">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,</div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>  StkFormat <a class="code" href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );</div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  </div>
<div class="line"><a name="l00058"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4"> 58</a></span>  <a class="code" href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4">~FileRead</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>  </div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  </div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157"> 67</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157">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,</div>
<div class="line"><a name="l00068"></a><span class="lineno"> 68</span>  StkFormat <a class="code" href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef">format</a> = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a>, StkFloat rate = 22050.0 );</div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  </div>
<div class="line"><a name="l00071"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a"> 71</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a">close</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>  </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70"> 74</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70">isOpen</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div>
<div class="line"><a name="l00077"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a3b8521b31f77c77e04ad54b669e4ffb7"> 77</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classstk_1_1FileRead.html#a3b8521b31f77c77e04ad54b669e4ffb7">fileSize</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileSize_; };</div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  </div>
<div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a0703ebdc701f40a793b92c0879922685"> 80</a></span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classstk_1_1FileRead.html#a0703ebdc701f40a793b92c0879922685">channels</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> channels_; };</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  </div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef"> 83</a></span>  StkFormat <a class="code" href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef">format</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> dataType_; };</div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  </div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  </div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a9c325f6e8e30313e110b76e9b409fd44"> 91</a></span>  StkFloat <a class="code" href="classstk_1_1FileRead.html#a9c325f6e8e30313e110b76e9b409fd44">fileRate</a>( <span class="keywordtype">void</span> )<span class="keyword"> const </span>{ <span class="keywordflow">return</span> fileRate_; };</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  </div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  </div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="line" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8"> 106</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8">read</a>( <a class="code" href="classstk_1_1StkFrames.html">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> );</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  </div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span> <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  </div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="comment">// Get STK RAW file information.</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  <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,</div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span>  StkFormat <a class="code" href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef">format</a>, StkFloat rate );</div>
<div class="line"><a name="l00113"></a><span class="lineno"> 113</span>  </div>
<div class="line"><a name="l00114"></a><span class="lineno"> 114</span>  <span class="comment">// Get WAV file header information.</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  <span class="keywordtype">bool</span> getWavInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );</div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span>  </div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>  <span class="comment">// Get SND (AU) file header information.</span></div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>  <span class="keywordtype">bool</span> getSndInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>  </div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>  <span class="comment">// Get AIFF file header information.</span></div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>  <span class="keywordtype">bool</span> getAifInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>  </div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>  <span class="comment">// Get MAT-file header information.</span></div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>  <span class="keywordtype">bool</span> getMatInfo( <span class="keyword">const</span> <span class="keywordtype">char</span> *fileName );</div>
<div class="line"><a name="l00125"></a><span class="lineno"> 125</span>  </div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>  <span class="comment">// Helper function for MAT-file parsing.</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"> 127</span>  <span class="keywordtype">bool</span> findNextMatArray( SINT32 *chunkSize, SINT32 *rows, SINT32 *columns, SINT32 *nametype );</div>
<div class="line"><a name="l00128"></a><span class="lineno"> 128</span>  </div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>  FILE *fd_;</div>
<div class="line"><a name="l00130"></a><span class="lineno"> 130</span>  <span class="keywordtype">bool</span> byteswap_;</div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>  <span class="keywordtype">bool</span> wavFile_;</div>
<div class="line"><a name="l00132"></a><span class="lineno"> 132</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> fileSize_;</div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> dataOffset_;</div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;</div>
<div class="line"><a name="l00135"></a><span class="lineno"> 135</span>  StkFormat dataType_;</div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>  StkFloat fileRate_;</div>
<div class="line"><a name="l00137"></a><span class="lineno"> 137</span> };</div>
<div class="line"><a name="l00138"></a><span class="lineno"> 138</span>  </div>
<div class="line"><a name="l00139"></a><span class="lineno"> 139</span> } <span class="comment">// stk namespace</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"> 140</span>  </div>
<div class="line"><a name="l00141"></a><span class="lineno"> 141</span> <span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclassstk_1_1FileRead_html"><div class="ttname"><a href="classstk_1_1FileRead.html">stk::FileRead</a></div><div class="ttdoc">STK audio file input class.</div><div class="ttdef"><b>Definition:</b> FileRead.h:42</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a0703ebdc701f40a793b92c0879922685"><div class="ttname"><a href="classstk_1_1FileRead.html#a0703ebdc701f40a793b92c0879922685">stk::FileRead::channels</a></div><div class="ttdeci">unsigned int channels(void) const</div><div class="ttdoc">Return the number of audio channels in the file.</div><div class="ttdef"><b>Definition:</b> FileRead.h:80</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a24802c0e1846ea9f420f40293af4cde4"><div class="ttname"><a href="classstk_1_1FileRead.html#a24802c0e1846ea9f420f40293af4cde4">stk::FileRead::~FileRead</a></div><div class="ttdeci">~FileRead(void)</div><div class="ttdoc">Class destructor.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a3b8521b31f77c77e04ad54b669e4ffb7"><div class="ttname"><a href="classstk_1_1FileRead.html#a3b8521b31f77c77e04ad54b669e4ffb7">stk::FileRead::fileSize</a></div><div class="ttdeci">unsigned long fileSize(void) const</div><div class="ttdoc">Return the file size in sample frames.</div><div class="ttdef"><b>Definition:</b> FileRead.h:77</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a3f30ed2a9f45493f0369aa2edbf38f70"><div class="ttname"><a href="classstk_1_1FileRead.html#a3f30ed2a9f45493f0369aa2edbf38f70">stk::FileRead::isOpen</a></div><div class="ttdeci">bool isOpen(void)</div><div class="ttdoc">Returns true if a file is currently open.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a56d09169c0cca8623823579c7f80808a"><div class="ttname"><a href="classstk_1_1FileRead.html#a56d09169c0cca8623823579c7f80808a">stk::FileRead::close</a></div><div class="ttdeci">void close(void)</div><div class="ttdoc">If a file is open, close it.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a8eefe5d1479789c02ac2dfa76ba143f8"><div class="ttname"><a href="classstk_1_1FileRead.html#a8eefe5d1479789c02ac2dfa76ba143f8">stk::FileRead::read</a></div><div class="ttdeci">void read(StkFrames &buffer, unsigned long startFrame=0, bool doNormalize=true)</div><div class="ttdoc">Read sample frames from the file into an StkFrames object.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a9b8c55af1ca997dd3b808afcc54f3089"><div class="ttname"><a href="classstk_1_1FileRead.html#a9b8c55af1ca997dd3b808afcc54f3089">stk::FileRead::FileRead</a></div><div class="ttdeci">FileRead(void)</div><div class="ttdoc">Default constructor.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_a9c325f6e8e30313e110b76e9b409fd44"><div class="ttname"><a href="classstk_1_1FileRead.html#a9c325f6e8e30313e110b76e9b409fd44">stk::FileRead::fileRate</a></div><div class="ttdeci">StkFloat fileRate(void) const</div><div class="ttdoc">Return the file sample rate in Hz.</div><div class="ttdef"><b>Definition:</b> FileRead.h:91</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_ac34f61c4bfdc296f2285f458cc57ccef"><div class="ttname"><a href="classstk_1_1FileRead.html#ac34f61c4bfdc296f2285f458cc57ccef">stk::FileRead::format</a></div><div class="ttdeci">StkFormat format(void) const</div><div class="ttdoc">Return the data format of the file.</div><div class="ttdef"><b>Definition:</b> FileRead.h:83</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_acc11b53871e05af1b0342e2cc1fc3157"><div class="ttname"><a href="classstk_1_1FileRead.html#acc11b53871e05af1b0342e2cc1fc3157">stk::FileRead::open</a></div><div class="ttdeci">void open(std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=STK_SINT16, StkFloat rate=22050.0)</div><div class="ttdoc">Open the specified file and determine its formatting.</div></div>
<div class="ttc" id="aclassstk_1_1FileRead_html_aef47f180e2d7ef77a118b993541b372d"><div class="ttname"><a href="classstk_1_1FileRead.html#aef47f180e2d7ef77a118b993541b372d">stk::FileRead::FileRead</a></div><div class="ttdeci">FileRead(std::string fileName, bool typeRaw=false, unsigned int nChannels=1, StkFormat format=STK_SINT16, StkFloat rate=22050.0)</div><div class="ttdoc">Overloaded constructor that opens a file during instantiation.</div></div>
<div class="ttc" id="aclassstk_1_1StkFrames_html"><div class="ttname"><a href="classstk_1_1StkFrames.html">stk::StkFrames</a></div><div class="ttdoc">An STK class to handle vectorized audio data.</div><div class="ttdef"><b>Definition:</b> Stk.h:287</div></div>
<div class="ttc" id="aclassstk_1_1Stk_html"><div class="ttname"><a href="classstk_1_1Stk.html">stk::Stk</a></div><div class="ttdoc">STK base class.</div><div class="ttdef"><b>Definition:</b> Stk.h:144</div></div>
<div class="ttc" id="aclassstk_1_1Stk_html_a5a807971b7fc3c8985d97823be079a7b"><div class="ttname"><a href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">stk::Stk::STK_SINT16</a></div><div class="ttdeci">static const StkFormat STK_SINT16</div><div class="ttdef"><b>Definition:</b> Stk.h:149</div></div>
<div class="ttc" id="anamespacestk_html"><div class="ttname"><a href="namespacestk.html">stk</a></div><div class="ttdoc">The STK namespace.</div><div class="ttdef"><b>Definition:</b> ADSR.h:8</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>