File: FileWrite_8h_source.html

package info (click to toggle)
stk 4.4.4-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 24,856 kB
  • sloc: cpp: 33,976; tcl: 2,375; sh: 2,319; ansic: 163; perl: 114; makefile: 37
file content (105 lines) | stat: -rw-r--r-- 9,831 bytes parent folder | download | duplicates (2)
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
<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"> &nbsp; <img src="ccrma.gif"> &nbsp; <img src="mcgill.gif"><P>
<a class="qindex" href="index.html">Home</a> &nbsp; <a class="qindex" href="information.html">Information</a> &nbsp; <a class="qindex" href="classes.html">Classes</a> &nbsp; <a class="qindex" href="download.html">Download</a> &nbsp; <a class="qindex" href="usage.html">Usage</a> &nbsp; <a class="qindex" href="maillist.html">Mail List</a> &nbsp; <a class="qindex" href="system.html">Requirements</a> &nbsp; <a class="qindex" href="links.html">Links</a> &nbsp; <a class="qindex" href="faq.html">FAQ</a> &nbsp; <a class="qindex" href="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.6.2 -->
  <div class="navpath"><a class="el" href="dir_221deb9bdff892d63ed1e409450a60d2.html">include</a>
  </div>
<div class="contents">
<h1>FileWrite.h</h1><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef STK_FILEWRITE_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define STK_FILEWRITE_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &quot;Stk.h&quot;</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="l00029"></a>00029 <span class="comment">/***************************************************/</span>
<a name="l00030"></a>00030 
<a name="l00031"></a><a class="code" href="classstk_1_1FileWrite.html">00031</a> <span class="keyword">class </span><a class="code" href="classstk_1_1FileWrite.html" title="STK audio file output class.">FileWrite</a> : <span class="keyword">public</span> <a class="code" href="classstk_1_1Stk.html" title="STK base class.">Stk</a>
<a name="l00032"></a>00032 {
<a name="l00033"></a>00033  <span class="keyword">public</span>:
<a name="l00034"></a>00034 
<a name="l00035"></a>00035   <span class="keyword">typedef</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> FILE_TYPE;
<a name="l00036"></a>00036 
<a name="l00037"></a><a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">00037</a>   <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ac9e286cfc8037327eef493439e78f31e">FILE_RAW</a>; 
<a name="l00038"></a><a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">00038</a>   <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a800875bbcac8f137ed94f5606d55f8c6">FILE_WAV</a>; 
<a name="l00039"></a><a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">00039</a>   <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a1ae24c549fc9fa2c8ef4a6ff94ccc345">FILE_SND</a>; 
<a name="l00040"></a><a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">00040</a>   <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#a678074f8bfa198627ed8ee9f52a42c0e">FILE_AIF</a>; 
<a name="l00041"></a><a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">00041</a>   <span class="keyword">static</span> <span class="keyword">const</span> FILE_TYPE <a class="code" href="classstk_1_1FileWrite.html#ad06e073000f613c43c48707c724d104e">FILE_MAT</a>; 
<a name="l00043"></a>00043 
<a name="l00044"></a>00044   <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">FileWrite</a>( <span class="keywordtype">void</span> );
<a name="l00045"></a>00045 
<a name="l00047"></a>00047 
<a name="l00050"></a>00050   <a class="code" href="classstk_1_1FileWrite.html#ab362583b465c41ac0b411722621e9d3d" title="Default constructor.">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> );
<a name="l00051"></a>00051 
<a name="l00053"></a>00053   <span class="keyword">virtual</span> <a class="code" href="classstk_1_1FileWrite.html#ac4da2511c8d0640ec5484f88bd704747" title="Class destructor.">~FileWrite</a>();
<a name="l00054"></a>00054 
<a name="l00056"></a>00056 
<a name="l00059"></a>00059   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a7575ddb275c902207b7b6518bb5a4ed9" title="Create a file of the specified type and name and output samples to it in the given...">open</a>( std::string fileName, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nChannels = 1,
<a name="l00060"></a>00060              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> );
<a name="l00061"></a>00061 
<a name="l00063"></a>00063   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#a99a19988a4dd8d608b74421cfb6cbc69" title="If a file is open, write out samples in the queue and then close it.">close</a>( <span class="keywordtype">void</span> );
<a name="l00064"></a>00064 
<a name="l00066"></a>00066   <span class="keywordtype">bool</span> <a class="code" href="classstk_1_1FileWrite.html#a636436624aa39eb5ba3401a9279a173e" title="Returns true if a file is currently open.">isOpen</a>( <span class="keywordtype">void</span> );
<a name="l00067"></a>00067 
<a name="l00069"></a>00069 
<a name="l00074"></a>00074   <span class="keywordtype">void</span> <a class="code" href="classstk_1_1FileWrite.html#ad33ca8e729c14296af6dce457445832e" title="Write sample frames from the StkFrames object to the file.">write</a>( <a class="code" href="classstk_1_1StkFrames.html" title="An STK class to handle vectorized audio data.">StkFrames</a>&amp; buffer );
<a name="l00075"></a>00075 
<a name="l00076"></a>00076  <span class="keyword">protected</span>:
<a name="l00077"></a>00077 
<a name="l00078"></a>00078   <span class="comment">// Write STK RAW file header.</span>
<a name="l00079"></a>00079   <span class="keywordtype">bool</span> setRawFile( std::string fileName );
<a name="l00080"></a>00080 
<a name="l00081"></a>00081   <span class="comment">// Write WAV file header.</span>
<a name="l00082"></a>00082   <span class="keywordtype">bool</span> setWavFile( std::string fileName );
<a name="l00083"></a>00083 
<a name="l00084"></a>00084   <span class="comment">// Close WAV file, updating the header.</span>
<a name="l00085"></a>00085   <span class="keywordtype">void</span> closeWavFile( <span class="keywordtype">void</span> );
<a name="l00086"></a>00086 
<a name="l00087"></a>00087   <span class="comment">// Write SND (AU) file header.</span>
<a name="l00088"></a>00088   <span class="keywordtype">bool</span> setSndFile( std::string fileName );
<a name="l00089"></a>00089 
<a name="l00090"></a>00090   <span class="comment">// Close SND file, updating the header.</span>
<a name="l00091"></a>00091   <span class="keywordtype">void</span> closeSndFile( <span class="keywordtype">void</span> );
<a name="l00092"></a>00092 
<a name="l00093"></a>00093   <span class="comment">// Write AIFF file header.</span>
<a name="l00094"></a>00094   <span class="keywordtype">bool</span> setAifFile( std::string fileName );
<a name="l00095"></a>00095 
<a name="l00096"></a>00096   <span class="comment">// Close AIFF file, updating the header.</span>
<a name="l00097"></a>00097   <span class="keywordtype">void</span> closeAifFile( <span class="keywordtype">void</span> );
<a name="l00098"></a>00098 
<a name="l00099"></a>00099   <span class="comment">// Write MAT-file header.</span>
<a name="l00100"></a>00100   <span class="keywordtype">bool</span> setMatFile( std::string fileName );
<a name="l00101"></a>00101 
<a name="l00102"></a>00102   <span class="comment">// Close MAT-file, updating the header.</span>
<a name="l00103"></a>00103   <span class="keywordtype">void</span> closeMatFile( <span class="keywordtype">void</span> );
<a name="l00104"></a>00104 
<a name="l00105"></a>00105   FILE *fd_;
<a name="l00106"></a>00106   FILE_TYPE fileType_;
<a name="l00107"></a>00107   StkFormat dataType_;
<a name="l00108"></a>00108   <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> channels_;
<a name="l00109"></a>00109   <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> frameCounter_;
<a name="l00110"></a>00110   <span class="keywordtype">bool</span> byteswap_;
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 };
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 } <span class="comment">// stk namespace</span>
<a name="l00115"></a>00115 
<a name="l00116"></a>00116 <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>&copy;1995-2012 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>

</BODY>
</HTML>