forked from pschatzmann/arduino-stk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFileWrite_8h_source.html
144 lines (144 loc) · 20 KB
/
FileWrite_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
139
140
141
142
143
144
<!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: FileWrite.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">FileWrite.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_FILEWRITE_H</span></div>
<div class="line"><a name="l00002"></a><span class="lineno"> 2</span> <span class="preprocessor">#define STK_FILEWRITE_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="l00029"></a><span class="lineno"> 29</span> <span class="comment">/***************************************************/</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>  </div>
<div class="line"><a name="l00031"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html"> 31</a></span> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html">Stk</a></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span> {</div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>  <span class="keyword">public</span>:</div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>  </div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>  <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;</div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>  </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e"> 37</a></span>  <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">FILE_RAW</a>; </div>
<div class="line"><a name="l00038"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6"> 38</a></span>  <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>; </div>
<div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345"> 39</a></span>  <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>; </div>
<div class="line"><a name="l00040"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e"> 40</a></span>  <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>; </div>
<div class="line"><a name="l00041"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e"> 41</a></span>  <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">FILE_MAT</a>; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d"> 44</a></span>  <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d">FileWrite</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>  </div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>  </div>
<div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a207f10bba60355fe3dc62dc837edee46"> 50</a></span>  <a class="code" href="classstk_1_1FileWrite.html#a207f10bba60355fe3dc62dc837edee46">FileWrite</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1, FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );</div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>  </div>
<div class="line"><a name="l00053"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747"> 53</a></span>  <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747">~FileWrite</a>();</div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>  </div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>  </div>
<div class="line"><a name="l00059"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9"> 59</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,</div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>  FileWrite::FILE_TYPE type = <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>, Stk::StkFormat format = <a class="code" href="classstk_1_1Stk.html#a5a807971b7fc3c8985d97823be079a7b">STK_SINT16</a> );</div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>  </div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69"> 63</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69">close</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>  </div>
<div class="line"><a name="l00066"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e"> 66</a></span>  <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e">isOpen</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00067"></a><span class="lineno"> 67</span>  </div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>  </div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e"> 74</a></span>  <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e">write</a>( <a class="code" href="classstk_1_1StkFrames.html">StkFrames</a>& buffer );</div>
<div class="line"><a name="l00075"></a><span class="lineno"> 75</span>  </div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>  <span class="keyword">protected</span>:</div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>  </div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>  <span class="comment">// Write STK RAW file header.</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>  <span class="keywordtype">bool</span> setRawFile( std::string fileName );</div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>  </div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>  <span class="comment">// Write WAV file header.</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"> 82</span>  <span class="keywordtype">bool</span> setWavFile( std::string fileName );</div>
<div class="line"><a name="l00083"></a><span class="lineno"> 83</span>  </div>
<div class="line"><a name="l00084"></a><span class="lineno"> 84</span>  <span class="comment">// Close WAV file, updating the header.</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"> 85</span>  <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00086"></a><span class="lineno"> 86</span>  </div>
<div class="line"><a name="l00087"></a><span class="lineno"> 87</span>  <span class="comment">// Write SND (AU) file header.</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"> 88</span>  <span class="keywordtype">bool</span> setSndFile( std::string fileName );</div>
<div class="line"><a name="l00089"></a><span class="lineno"> 89</span>  </div>
<div class="line"><a name="l00090"></a><span class="lineno"> 90</span>  <span class="comment">// Close SND file, updating the header.</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"> 91</span>  <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00092"></a><span class="lineno"> 92</span>  </div>
<div class="line"><a name="l00093"></a><span class="lineno"> 93</span>  <span class="comment">// Write AIFF file header.</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"> 94</span>  <span class="keywordtype">bool</span> setAifFile( std::string fileName );</div>
<div class="line"><a name="l00095"></a><span class="lineno"> 95</span>  </div>
<div class="line"><a name="l00096"></a><span class="lineno"> 96</span>  <span class="comment">// Close AIFF file, updating the header.</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"> 97</span>  <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00098"></a><span class="lineno"> 98</span>  </div>
<div class="line"><a name="l00099"></a><span class="lineno"> 99</span>  <span class="comment">// Write MAT-file header.</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"> 100</span>  <span class="keywordtype">bool</span> setMatFile( std::string fileName );</div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>  </div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>  <span class="comment">// Close MAT-file, updating the header.</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"> 103</span>  <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00104"></a><span class="lineno"> 104</span>  </div>
<div class="line"><a name="l00105"></a><span class="lineno"> 105</span>  FILE *fd_;</div>
<div class="line"><a name="l00106"></a><span class="lineno"> 106</span>  FILE_TYPE fileType_;</div>
<div class="line"><a name="l00107"></a><span class="lineno"> 107</span>  StkFormat dataType_;</div>
<div class="line"><a name="l00108"></a><span class="lineno"> 108</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;</div>
<div class="line"><a name="l00109"></a><span class="lineno"> 109</span>  <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;</div>
<div class="line"><a name="l00110"></a><span class="lineno"> 110</span>  <span class="keywordtype">bool</span> byteswap_;</div>
<div class="line"><a name="l00111"></a><span class="lineno"> 111</span>  </div>
<div class="line"><a name="l00112"></a><span class="lineno"> 112</span> };</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">// stk namespace</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>  </div>
<div class="line"><a name="l00116"></a><span class="lineno"> 116</span> <span class="preprocessor">#endif</span></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html"><div class="ttname"><a href="classstk_1_1FileWrite.html">stk::FileWrite</a></div><div class="ttdoc">STK audio file output class.</div><div class="ttdef"><b>Definition:</b> FileWrite.h:32</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a1ae24c549fc9fa2c8ef4a6ff94ccc345"><div class="ttname"><a href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">stk::FileWrite::FILE_SND</a></div><div class="ttdeci">static const FILE_TYPE FILE_SND</div><div class="ttdef"><b>Definition:</b> FileWrite.h:39</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a207f10bba60355fe3dc62dc837edee46"><div class="ttname"><a href="classstk_1_1FileWrite.html#a207f10bba60355fe3dc62dc837edee46">stk::FileWrite::FileWrite</a></div><div class="ttdeci">FileWrite(std::string fileName, unsigned int nChannels=1, FILE_TYPE type=FILE_WAV, Stk::StkFormat format=STK_SINT16)</div><div class="ttdoc">Overloaded constructor used to specify a file name, type, and data format with this object.</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a636436624aa39eb5ba3401a9279a173e"><div class="ttname"><a href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e">stk::FileWrite::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_1FileWrite_html_a678074f8bfa198627ed8ee9f52a42c0e"><div class="ttname"><a href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">stk::FileWrite::FILE_AIF</a></div><div class="ttdeci">static const FILE_TYPE FILE_AIF</div><div class="ttdef"><b>Definition:</b> FileWrite.h:40</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a7575ddb275c902207b7b6518bb5a4ed9"><div class="ttname"><a href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9">stk::FileWrite::open</a></div><div class="ttdeci">void open(std::string fileName, unsigned int nChannels=1, FileWrite::FILE_TYPE type=FILE_WAV, Stk::StkFormat format=STK_SINT16)</div><div class="ttdoc">Create a file of the specified type and name and output samples to it in the given data format.</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a800875bbcac8f137ed94f5606d55f8c6"><div class="ttname"><a href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">stk::FileWrite::FILE_WAV</a></div><div class="ttdeci">static const FILE_TYPE FILE_WAV</div><div class="ttdef"><b>Definition:</b> FileWrite.h:38</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_a99a19988a4dd8d608b74421cfb6cbc69"><div class="ttname"><a href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69">stk::FileWrite::close</a></div><div class="ttdeci">void close(void)</div><div class="ttdoc">If a file is open, write out samples in the queue and then close it.</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_ab362583b465c41ac0b411722621e9d3d"><div class="ttname"><a href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d">stk::FileWrite::FileWrite</a></div><div class="ttdeci">FileWrite(void)</div><div class="ttdoc">Default constructor.</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_ac4da2511c8d0640ec5484f88bd704747"><div class="ttname"><a href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747">stk::FileWrite::~FileWrite</a></div><div class="ttdeci">virtual ~FileWrite()</div><div class="ttdoc">Class destructor.</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_ac9e286cfc8037327eef493439e78f31e"><div class="ttname"><a href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">stk::FileWrite::FILE_RAW</a></div><div class="ttdeci">static const FILE_TYPE FILE_RAW</div><div class="ttdef"><b>Definition:</b> FileWrite.h:37</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_ad06e073000f613c43c48707c724d104e"><div class="ttname"><a href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">stk::FileWrite::FILE_MAT</a></div><div class="ttdeci">static const FILE_TYPE FILE_MAT</div><div class="ttdef"><b>Definition:</b> FileWrite.h:41</div></div>
<div class="ttc" id="aclassstk_1_1FileWrite_html_ad33ca8e729c14296af6dce457445832e"><div class="ttname"><a href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e">stk::FileWrite::write</a></div><div class="ttdeci">void write(StkFrames &buffer)</div><div class="ttdoc">Write sample frames from the StkFrames object to the file.</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>