blob: 235fda2063a6d3022a8f4b7c8a8280ff82fec607 (
plain)
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
|
<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"><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="tutorial.html">Tutorial</a></CENTER>
<HR>
<!-- Generated by Doxygen 1.3-rc3 -->
<h1>MidiFileIn.h</h1><div class="fragment"><pre>00001 <span class="comment">/**********************************************************************/</span>
00016 <span class="comment">/**********************************************************************/</span>
00017
00018 <span class="preprocessor">#ifndef STK_MIDIFILEIN_H</span>
00019 <span class="preprocessor"></span><span class="preprocessor">#define STK_MIDIFILEIN_H</span>
00020 <span class="preprocessor"></span>
00021 <span class="preprocessor">#include "Stk.h"</span>
00022 <span class="preprocessor">#include <string></span>
00023 <span class="preprocessor">#include <vector></span>
00024 <span class="preprocessor">#include <fstream></span>
00025 <span class="preprocessor">#include <sstream></span>
00026
<a name="l00027"></a><a class="code" href="classMidiFileIn.html">00027</a> <span class="keyword">class </span><a class="code" href="classMidiFileIn.html">MidiFileIn</a> : <span class="keyword">public</span> <a class="code" href="classStk.html">Stk</a>
00028 {
00029 <span class="keyword">public</span>:
00031
00035 <a class="code" href="classMidiFileIn.html#a0">MidiFileIn</a>( std::string fileName );
00036
00038 <a class="code" href="classMidiFileIn.html#a1">~MidiFileIn</a>();
00039
00041 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a2">getFileFormat</a>() <span class="keyword">const</span>;
00042
00044 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a3">getNumberOfTracks</a>() <span class="keyword">const</span>;
00045
00047
00052 <span class="keywordtype">int</span> <a class="code" href="classMidiFileIn.html#a4">getDivision</a>() <span class="keyword">const</span>;
00053
00055
00059 <span class="keywordtype">void</span> <a class="code" href="classMidiFileIn.html#a5">rewindTrack</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
00060
00062
00069 <span class="keywordtype">double</span> <a class="code" href="classMidiFileIn.html#a6">getTickSeconds</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
00070
00072
00084 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classMidiFileIn.html#a7">getNextEvent</a>( std::vector<unsigned char> *event, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
00085
00087
00097 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <a class="code" href="classMidiFileIn.html#a8">getNextMidiEvent</a>( std::vector<unsigned char> *midiEvent, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> track = 0 );
00098
00099 <span class="keyword">protected</span>:
00100
00101 <span class="comment">// This protected class function is used for reading variable-length</span>
00102 <span class="comment">// MIDI file values. It is assumed that this function is called with</span>
00103 <span class="comment">// the file read pointer positioned at the start of a</span>
00104 <span class="comment">// variable-length value. The function returns true if the value is</span>
00105 <span class="comment">// successfully parsed. Otherwise, it returns false.</span>
00106 <span class="keywordtype">bool</span> readVariableLength( <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> *value );
00107
00108 std::ifstream file_;
00109 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> nTracks_;
00110 <span class="keywordtype">int</span> format_;
00111 <span class="keywordtype">int</span> division_;
00112 <span class="keywordtype">bool</span> usingTimeCode_;
00113 std::vector<double> tickSeconds_;
00114 std::vector<long> trackPointers_;
00115 std::vector<long> trackOffsets_;
00116 std::vector<long> trackLengths_;
00117 std::vector<char> trackStatus_;
00118 std::ostringstream errorString_;
00119
00120 <span class="comment">// This structure and the following variables are used to save and</span>
00121 <span class="comment">// keep track of a format 1 tempo map (and the initial tickSeconds</span>
00122 <span class="comment">// parameter for formats 0 and 2).</span>
00123 <span class="keyword">struct </span>TempoChange {
00124 <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> count;
00125 <span class="keywordtype">double</span> tickSeconds;
00126 };
00127 std::vector<TempoChange> tempoEvents_;
00128 std::vector<unsigned long> trackCounters_;
00129 std::vector<unsigned int> trackTempoIndex_;
00130 };
00131
00132 <span class="preprocessor">#endif</span>
</pre></div><HR>
<table>
<tr><td><A HREF="http://www-ccrma.stanford.edu/software/stk/"><I>The Synthesis ToolKit in C++ (STK)</I></A></td></tr>
<tr><td>©1995-2002 Perry R. Cook and Gary P. Scavone. All Rights Reserved.</td></tr>
</table>
</BODY>
</HTML>
|